[R] filled.contour and time axis
David Winsemius
dwinsemius at comcast.net
Sat Feb 28 20:53:38 CET 2009
The filled.contour help page offers a somewhat more extensive example
for using plot.axes than you have attempted:
plot.axes = { axis(1, seq(100, 800, by = 100)) axis(2, seq(100, 600,
by = 100)) },
And looking at the help page for axis() shows that the default setting
for at is NULL, so it is "correctly formatted" as called, and you
instead need to tell axis where to place the ticks and labels. This
minor hack of the filled.contour example using the pretty function may
offer ideas that you can apply to your code (whatever it might be.)
x <- 10*1:nrow(volcano)
y <- 10*1:ncol(volcano)
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, pretty(x,min=0))
axis(2, seq(100, 600, by = 100)) },
key.title = title(main="Height\n(meters)"),
key.axes = axis(4, seq(90, 190, by = 10)))# maybe also asp=1
mtext(paste("filled.contour(.) from", R.version.string),
side = 1, line = 4, adj = 1, cex = .66)
# Bottom line ... read the axis help page and the links from it.
--
David Winsemius
On Feb 28, 2009, at 2:32 PM, Pieter Beck wrote:
> Dear all,
>
> I am using filled.contour and my x-axis consists of a vector of dates,
> formatted using as.POSIXct.
>
> When I assign this vector to x in filled.contour, the x-axis in the
> plot is
> correctly formatted as dates.
>
> However, when I use plot.axes=axis(1) in filled.contour the x-axis
> is not
> correctly formatted. I need to opt for the latter because I want to
> add
> additional lines and points to the graph using plot.axes.
>
> Does anyone have a suggestion of how to make sure the x-axis is
> correctly
> formatted as time/dates when I explicitly plot it using plot.axes?
>
> Many thanks in advance,
>
> Pieter Beck
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
More information about the R-help
mailing list