I am looking for ways to fully fill in the contour generated by ggplot2's stat_contour. The current result is like this:
# Generate data
library(ggplot2)
library(reshape2) # for melt
volcano3d <- melt(volcano)
names(volcano3d) <- c("x", "y", "z")
v <- ggplot(volcano3d, aes(x, y, z = z))
v + stat_contour(geom="polygon", aes(fill=..level..))
The desired result can be produced by manually modifying the codes as follows.
v + stat_contour(geom="polygon", aes(fill=..level..)) +
theme(panel.grid=element_blank())+ # delete grid lines
scale_x_continuous(limits=c(min(volcano3d$x),max(volcano3d$x)), expand=c(0,0))+ # set x limits
scale_y_continuous(limits=c(min(volcano3d$y),max(volcano3d$y)), expand=c(0,0))+ # set y limits
theme(panel.background=element_rect(fill="#132B43")) # color background
My question: is there a way to fully fill the plot without manually specifying the color or using geom_tile()
?