Re: [R] filled.contour with log axis

2008-02-17 Thread Duncan Murdoch
On 16/02/2008 7:33 PM, Thomas Hoffmann wrote:
> 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?

You could transform your x and y values to their logs, and then use 
custom axis() calls to plot the axes.  For example, a modification of 
the first example from ?filled.contour:

x <- 10*1:nrow(volcano)
xtick <- pretty(x)
x <- log(x)
y <- 10*1:ncol(volcano)
ytick <- pretty(y)
y <- log(y)
filled.contour(x, y, volcano, color = terrain.colors,
 plot.title = title(main = "The Topography of Maunga Whau",
 xlab = "Meters North", ylab = "Meters West"),
 plot.axes = { axis(1, at=log(xtick), label=xtick);
   axis(2, at=log(ytick), label=ytick) },
 key.title = title(main="Height\n(meters)"),
 key.axes = axis(4, seq(90, 190, by = 10)))# maybe also asp=1

Duncan Murdoch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] filled.contour with log axis

2008-02-17 Thread David Winsemius
Thomas Hoffmann <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]: 

> 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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] filled.contour with log axis

2008-02-16 Thread Thomas Hoffmann
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?

Thanks
Thomas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.