[R] filled.contour with log axis

David Winsemius dwinsemius at comcast.net
Sun Feb 17 14:55:25 CET 2008


Thomas Hoffmann <thomas.hoffmann at uni-bonn.de> wrote in
news:47B780EE.90101 at uni-bonn.de: 

> Dear all,
> 
> I would like to generate a filled.contour plot with log x and y
> axis, however using:
> 
> filled.contour(as.line,log="xy")
> 
> results in a warning message.
> 
> 
> Does anybody knos what to do?

Use a function that does accept the a parameter that does what you expect 
from log? Perhaps contourplot from the lattice package which has an 
extremely versatile scales parameter.

Or the stat_contour() geometry in ggplot2? I did not find a scale or a 
log argument but there was an example at Hadley's webpage that used a 
scale modification to the z value.  This experiment based on that that 
example seemed to create the expected behavior:

library(ggplot2)
volcano3d <- rename(melt(volcano), c(X1="x", X2="y", value="z")) 
v <- ggplot(volcano3d, aes(x=x,y=y,z=z)) 
v + stat_contour() +scale_x_log10() +scale_y_log10()

-- 
David Winsemius



More information about the R-help mailing list