Description Usage Arguments Examples
The list x
contains, in turn,
lists which have the elements x
, y
, z
,
each of which represent one dataset to be plotted.
1 2 3 |
data |
the data list, a list of lists where each element
is a list with elements |
plotPoints |
should the raw points be plotted? |
model |
a |
predict |
a |
modelSteps |
the number of steps for modeling along each axis |
legend |
the legend |
legendWidth |
the fraction of the plot to be allocated for the legend |
... |
Arguments passed on to
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | library(plotteR)
# set a random seed for replicability
set.seed(1000L);
# generate the first example dataset
f1 <- function(x, y) (x*x - y*y);
x1 <- runif(n=400, min=-2, max=2);
y1 <- runif(n=400, min=-2, max=2);
z1 <- f1(x1, y1);
d1 <- list(x=x1, y=y1, z=z1);
# generate the second example dataset
f2 <- function(x, y) 0.8*x + 0.25*y - 7;
x2 <- runif(n=400, min=-2, max=2);
y2 <- runif(n=400, min=-2, max=2);
# here we even add a bit of randomness into the data
z2 <- rnorm(n=400, mean=f2(x2, y2), sd=0.3);
d2 <- list(x=x2, y=y2, z=z2);
# plot the data together with the interpolated surfaces
batchPlot.3d(list(d1, d2), plotPoints=TRUE, legend=c("f1", "f2"), legendWidth=0.1);
readline("Press return to continue");
# now we just plot the actual surfaces for comparison.
d1$f <- f1;
d2$f <- f2;
batchPlot.3d(list(d1, d2), plotPoints=FALSE, legend=c("f1", "f2"),
model=function(d) d$f,
predict=function(m, x, y) m(x, y), legendWidth=0.1);
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.