stat_contour {ggplot2} | R Documentation |
Contours of 3d data
stat_contour(mapping=NULL, data=NULL, geom="path", position="identity", na.rm=FALSE, ...)
mapping |
mapping between variables and aesthetics generated by aes |
data |
dataset used in this layer, if not specified uses plot dataset |
geom |
geometric used by this layer |
position |
position adjustment used by this layer |
na.rm |
NULL |
... |
ignored |
This page describes stat_contour, see layer
and qplot
for how to create a complete plot from individual components.
A layer
The following aesthetics can be used with stat_contour. Aesthetics are mapped to variables in the data with the aes
function: stat\_contour(\code{aes}(x = var))
x
: x position (required)
y
: y position (required)
z
: z position (required)
group
: how observations are divided into different groups
Hadley Wickham, http://had.co.nz/
## Not run: # Generate data volcano3d <- rename(melt(volcano), c(X1="x", X2="y", value="z")) v <- ggplot(volcano3d, aes(x=x,y=y,z=z)) v + stat_contour() # Add aesthetic mappings v + stat_contour(aes(size = ..level..)) v + stat_contour(aes(colour = ..level..)) # Change scale v + stat_contour(aes(colour = ..level..), size=2) + scale_colour_gradient(low="brown", high="white") v + stat_contour() + scale_z_continuous(breaks=c(100, 150)) v + stat_contour(size=0.5) + scale_z_continuous(breaks=seq(95, 195, by=2)) v + stat_contour() + scale_z_log10() # Set aesthetics to fixed value v + stat_contour(colour="red") v + stat_contour(size=2, linetype=4) # Try different geoms v + stat_contour(geom="polygon", aes(fill=..level..)) v + geom_tile(aes(fill=z)) + stat_contour() # Use qplot instead qplot(x, y, z, data=volcano3d, geom="contour") qplot(x, y, z, data=volcano3d, stat="contour", geom="path") ## End(Not run)