
This function is a wrapper around image
and contour
. See vignette('plotfunctions')
for an example of how you could use image
and
contour
.
plotsurface(
data,
view,
predictor = NULL,
valCI = NULL,
main = NULL,
xlab = NULL,
ylab = NULL,
xlim = NULL,
ylim = NULL,
zlim = NULL,
col = NULL,
color = terrain.colors(50),
ci.col = c("green", "red"),
nCol = 50,
add.color.legend = TRUE,
dec = NULL,
fit.margin = TRUE,
...
)
Data frame or list with plot data. A data frame needs to have a column with x values, a column with y values and a column with z values. A list contains a vector with unique x values, a vector with unique y values, and a matrix with z-values. The output of the function fvisgam is an example of a suitable list.
A vector with the names or numbers of the columns to plot on the x axis and y axis respectively.
Optional: the name of the column in the data frame
data
that provides the z-values. If data contains more than one
column besides the x- and y-values, the predictor
should be provided.
Optional: the name of the column in the data frame
data
that provides the CI-values. If not NULL, CI contour lines
will be plotted.
Text string, an overall title for the plot.
Label for x axis. Default is name of first view
variable.
Label for y axis. Default is name of second view
variable.
x-limits for the plot.
y-limits for the plot.
z-limits for the plot.
Color for the contour lines and labels.
The color scheme to use for plots. One of 'topo', 'heat',
'cm', 'terrain', 'gray', 'bwr' (blue-white-red) or 'bw'. Or a list of colors such as that
generated by rainbow
,
heat.colors
colors
, topo.colors
,
terrain.colors
or similar functions.
Alternatively a vector with some colors can be provided for a custom
color palette.
Two-value vector with colors for the lower CI contour lines and for the upper CI contour lines.
The number of colors to use in color schemes.
Logical: whether or not to add a color legend.
Default is TRUE. If FALSE (omitted), one could use the function
gradientLegend
to add a legend manually at any position.
Numeric: number of decimals for rounding the color legend.
When NULL (default), no rounding. If -1 (default), automatically determined.
Note: if value = -1 (default), rounding will be applied also when
zlim
is provided.
Logical: whether the labels of the gradient legend should be forced to fit in the margin or not.
Other Functions for plotting:
addInterval()
,
add_bars()
,
add_n_points()
,
alphaPalette()
,
alpha()
,
check_normaldist()
,
color_contour()
,
dotplot_error()
,
drawDevArrows()
,
emptyPlot()
,
errorBars()
,
fill_area()
,
getCoords()
,
getFigCoords()
,
getProps()
,
gradientLegend()
,
legend_margin()
,
marginDensityPlot()
,
plot_error()
,
plot_image()
,
sortBoxplot()
# NOT RUN {
# From the package graphics, see help(image):
x <- 10*(1:nrow(volcano))
y <- 10*(1:ncol(volcano))
image(x, y, volcano, col = terrain.colors(100), axes = FALSE)
contour(x, y, volcano, levels = seq(90, 200, by = 5),
add = TRUE, col = 'peru')
axis(1, at = seq(100, 800, by = 100))
axis(2, at = seq(100, 600, by = 100))
box()
title(main = 'Maunga Whau Volcano', font.main = 4)
# now with plot surface:
# first convert to data frame
tmp <- data.frame(value = as.vector(volcano),
x = 10*rep(1:nrow(volcano), ncol(volcano)),
y = 10*rep(1:ncol(volcano), each=nrow(volcano)))
plotsurface(tmp, view=c('x', 'y'), predictor='value',
main='Maunga Whau Volcano')
# or with gray scale colors:
plotsurface(tmp, view=c('x', 'y'), predictor='value',
main='Maunga Whau Volcano', color='gray')
# change color range:
plotsurface(tmp, view=c('x', 'y'), predictor='value',
main='Maunga Whau Volcano', zlim=c(0,200))
#' remove color and color legend:
plotsurface(tmp, view=c('x', 'y'), predictor='value',
main='Maunga Whau Volcano',
color=NULL, col=1, add.color.legend=FALSE)
# }
Run the code above in your browser using DataLab