Re: [R] filled.contour with log axis

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Sun, 17 Feb 2008 09:11:28 -0500

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_at_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. Received on Sun 17 Feb 2008 - 14:41:22 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 17 Feb 2008 - 16:30:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive