I want to create a contour plot that has a color key next to it.
I would make the contour plot like this:
data(volcano)
image(volcano)
contour(volcano, add = TRUE)
However, image()
does not support a legend as far as I know. I saw that there is also a contourplot()
function in the lattice
package, however, I cannot figure it out how to overlay
the map with the contour lines when using levelplot(volcano)
and contourplot(volcano)
Ideally I want my plot to look like this but with a color key: