Skip to content

Commit

Permalink
Initial commit of files
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruce Johnson authored and Bruce Johnson committed May 9, 2016
0 parents commit e43f6c4
Show file tree
Hide file tree
Showing 22 changed files with 2,518 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target
nb-configuration.xml
20 changes: 20 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export(fxinit)
export(q)
export(fxstage)
export(fxline)
export(fxseries)
export(fxtext)
export(fxplot)
export(fxplot.xy)
export(fxplot.chart)
export(barplot)
export(dev.new)
export(fxdev.new)
export(fxdev.cur)
export(fxdev.set)
export(fxdev.next)
export(fxdev.prev)
export(plot,plot.default,plot.function,plot.factor,plot.xy,plot.new,plot.window)
export(lines,lines.default,lines.table)
export(curve)
export(dev.cur, dev.set, dev.next, dev.prev)
98 changes: 98 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.jfxplot</groupId>
<artifactId>plot</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<!-- general information about your package -->
<name>Plot</name>
<description>Plotting for renjin</description>
<url>http://www.url.to/your/package/website</url>
<licenses>
<!-- add one or more licenses under which the package is released -->
<license>
<name>General Public License 3.0</name>
<url>http://www.gnu.org/licenses</url>
</license>
</licenses>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<!-- the script engine is convenient even if you do not use it explicitly -->
<dependency>
<groupId>org.renjin</groupId>
<artifactId>renjin-script-engine</artifactId>
<version>0.7.0-RC7</version>
</dependency>
<!-- the hamcrest package is only required if you use it for unit tests -->
<dependency>
<groupId>org.renjin</groupId>
<artifactId>hamcrest</artifactId>
<version>0.7.0-RC7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.emxsys</groupId>
<artifactId>jfxchartext</artifactId>
<version>1.1</version>
</dependency>
</dependencies>

<repositories>
<repository>
<id>bedatadriven</id>
<name>bedatadriven public repo</name>
<url>https://nexus.bedatadriven.com/content/groups/public/</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>bedatadriven</id>
<name>bedatadriven public repo</name>
<url>https://nexus.bedatadriven.com/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

<plugin>
<groupId>org.renjin</groupId>
<artifactId>renjin-maven-plugin</artifactId>
<version>0.7.0-RC7</version>
<executions>
<execution>
<id>build</id>
<goals>
<goal>namespace-compile</goal>
</goals>
<phase>process-classes</phase>
</execution>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
77 changes: 77 additions & 0 deletions src/main/R/curve.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# File src/library/graphics/R/curve.R
# Part of the R package, https://www.R-project.org
#
# Copyright (C) 1995-2012 The R Core Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# A copy of the GNU General Public License is available at
# https://www.R-project.org/Licenses/

curve <- function(expr, from = NULL, to = NULL, n = 101, add = FALSE,
type = "l", xname = "x", xlab = xname,
ylab = NULL, log = NULL, xlim = NULL, ...)
{
print("incurve")
print(expr)
sexpr <- substitute(expr)
print(sexpr)
if (is.name(sexpr)) {
print("isname")
## beter than parse() !
xname2 <- as.name(xname)
print(xname2)
#expr <- call(as.character(sexpr), as.name(xname))
expr <- call(as.character(sexpr), xname2)
print(expr)
} else {
if ( !( (is.call(sexpr) || is.expression(sexpr)) &&
xname %in% all.vars(sexpr) ))
stop(gettextf("'expr' must be a function, or a call or an expression containing '%s'", xname), domain = NA)
expr <- sexpr
}
if (dev.cur() == 1L && !identical(add, FALSE)) {
warning("'add' will be ignored as there is no existing plot")
add <- FALSE
}
addF <- identical(add, FALSE)
if (is.null(ylab)) ylab <- deparse(expr)
if (is.null(from) || is.null(to)) {
xl <- if (!is.null(xlim)) xlim
else if (!addF) {
## determine xlim of current plot.
pu <- par("usr")[1L:2L]
if (par("xaxs") == "r") pu <- extendrange(pu, f = -1/27)
if (par("xlog")) 10^pu else pu
} else c(0, 1) # was c(1/27, 26/27) in R < 2.14.0
if (is.null(from)) from <- xl[1L]
if (is.null(to)) to <- xl[2L]
}
lg <- if (length(log)) log else if (!addF && par("xlog")) "x" else ""
if (length(lg) == 0) lg <- ""
if (grepl("x", lg, fixed = TRUE)) {
if (from <= 0 || to <= 0)
stop("'from' and 'to' must be > 0 with log=\"x\"")
x <- exp(seq.int(log(from), log(to), length.out = n))
} else x <- seq.int(from, to, length.out = n)
ll <- list(x = x); names(ll) <- xname
print(expr)
print(ll)
y <- eval(expr, envir = ll, enclos = parent.frame())
if (length(y) != length(x))
stop("'expr' did not evaluate to an object of length 'n'")
if (isTRUE(add))
lines(x = x, y = y, type = type, ...)
else
plot(x = x, y = y, type = type, xlab = xlab, ylab = ylab,
xlim = xlim, log = lg, ...)
invisible(list(x = x, y = y))
}
Loading

0 comments on commit e43f6c4

Please sign in to comment.