[R] Filled contour plot showing labeled isolines?

tremenyi tomremenyi at yahoo.com.au
Fri Aug 10 04:15:28 CEST 2012


I know this answer is really late, but I dont think this post was answered
properly.  

It seems like such obvious thing to want to do, you would think it would be
easy...
Well, it is!  Once you know how (of course).  
Hooray!

This took me ages to figure this out too! 

The answer is writen right there in the help file, but it isnt obvious.

This is the code from the help file ?filled.contour :
------------------------------------------------
# Annotating a filled contour plot
a <- expand.grid(1:20, 1:20)
b <- matrix(a[,1] + a[,2], 20)
filled.contour(x = 1:20, y = 1:20, z = b,
               plot.axes={ axis(1); axis(2); points(10,10) })
------------------------------------------------

Instead of "points(10,10)" add whatever you want to plot!  
So to add contour lines use this instead:  

------------------------------------------------
# Adding  contour lines to a filled contour plot
a <- expand.grid(1:20, 1:20)
b <- matrix(a[,1] + a[,2], 20)
filled.contour(x = 1:20, y = 1:20, z = b,
               plot.axes={ axis(1); axis(2); contour(x = 1:20, y = 1:20, z =
b, add=T) })
------------------------------------------------

Done!  
Happy plotting.




--
View this message in context: http://r.789695.n4.nabble.com/Filled-contour-plot-showing-labeled-isolines-tp3056437p4639849.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list