The same as cf_grid_screen but uses ggplot2 for the plot.
gcf_grid(x = seq(0, 1, length.out = nrow(z)), y = seq(0, 1, length.out
= ncol(z)), z, xlim = range(x, finite = TRUE), ylim = range(y, finite
= TRUE), zlim = range(z, finite = TRUE), with_lines = FALSE,
lines_only = FALSE, bins = 8, interpolate = TRUE,
levels = pretty(zlim, nlevels), nlevels = 20,
color.palette = cm.colors.strong, col = color.palette(length(levels)
- 1), asp = NA, las = 1, bar = F, pts = NULL, reset.par = TRUE,
pretitle = "", posttitle = "", main = NULL, mainminmax = !bar,
mainminmax_minmax = TRUE, afterplotfunc = NULL,
cex.main = par()$cex.main, ...)
x values, must form grid with y. If not given, it is assumed to be from 0 to 1.
y values, must form grid with x. If not given, it is assumed to be from 0 to 1.
z values at grid locations
x limits for the plot.
y limits for the plot.
z limits for the plot.
Should lines be added on top of contour to show contours?
Should no fill be used, only contour lines?
Number of lines used when using `with_lines` or `lines_only`
Will smooth out contours
a set of levels which are used to partition the range of z. Must be strictly increasing (and finite). Areas with z values between consecutive levels are painted with the same color.
if levels is not specified, the range of z, values is divided into approximately this many levels.
a color palette function to be used to assign colors in the plot. Defaults to cm.colors. Other options include rainbow, heat.colors, terrain.colors, topo.colors, and function(x) gray((1:x)/x).
an explicit set of colors to be used in the plot. This argument overrides any palette function specification. There should be one less color than levels
the y/x aspect ratio, see plot.window.
the style of labeling to be used. The default is to use horizontal labeling.
Should a bar showing the output range and colors be shown on the right?
Points to plot on top of contour
Should the graphical parameters be reset before exiting? Usually should be unless you need to add something to the plot afterwards and bar is TRUE.
Text to be preappended to end of plot title
Text to be appended to end of plot title
Title for the plot
whether the min and max values should be shown in the title of plot
Whether [min,max]= should be shown in title or just the numbers
Function to call after plotting, such as adding points or lines.
The size of the main title. 1.2 is default.
additional graphical parameters, currently only passed to title().
ggplot2 object
# NOT RUN {
x <- y <- seq(-4*pi, 4*pi, len = 27)
r <- sqrt(outer(x^2, y^2, "+"))
gcf_grid(cos(r^2)*exp(-r/(2*pi)))
gcf_grid(r, color.palette=heat.colors, bar=TRUE)
gcf_grid(r, color.palette=function(x) {gray((1:x)/x)}, bar=TRUE)
# }
Run the code above in your browser using DataLab