[R] filled.contour with log axis
Duncan Murdoch
murdoch at stats.uwo.ca
Sun Feb 17 15:11:28 CET 2008
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
More information about the R-help
mailing list