Dear group,
First I provide you with an example, I found in the newsgroup. Then I'd like
to explain my problem to you by means of the output.
enviro <-
data.frame(Year = rep(2001:2002, each = 365),
Day = rep(1:365, 2),
Precip = pmax(0, rnorm(365 * 2)),
Temp = 2 + 0.2 * rnorm(365 * 2))
xyplot(Precip + Temp ~ Day | Year, data=enviro,
layout = c(1, 2),
panel = panel.superpose.2,
type = c('h', 'l'))
Now my question.
How can I achieve different labels for two y-axes? (Here this is not the case,
but the example should just visualize my question.)
So here in this case I'd like to have two labels. On the "normal"
y-side (axis2) the label = "Precip", on the other side (axis4) the
label "Temp".
Thanks for your help.
Antje
[[alternative HTML version deleted]]
On 1/16/06, Antje Sch伱伡le <Antje.Schuele at komdat.com> wrote:> Dear group, > > > > First I provide you with an example, I found in the newsgroup. Then I'd like > to explain my problem to you by means of the output. > > > > enviro <- > data.frame(Year = rep(2001:2002, each = 365), > Day = rep(1:365, 2), > Precip = pmax(0, rnorm(365 * 2)), > Temp = 2 + 0.2 * rnorm(365 * 2)) > > > xyplot(Precip + Temp ~ Day | Year, data=enviro, > layout = c(1, 2), > panel = panel.superpose.2, > type = c('h', 'l')) > > > > Now my question. > > > > How can I achieve different labels for two y-axes? (Here this is not the > case, but the example should just visualize my question.) > > So here in this case I'd like to have two labels. On the "normal" y-side > (axis2) the label = "Precip", on the other side (axis4) the label "Temp".The design of xyplot etc doesn't permit this. One (fake) solution is to add a legend: xyplot(Precip + Temp ~ Day | Year, data=enviro, layout = c(1, 2), panel = panel.superpose.2, ylab = "Precip", legend = list(right list(fun = grid::textGrob("Temp", rot = 90))), type = c('h', 'l')) Deepayan -- http://www.stat.wisc.edu/~deepayan/
Maybe Matching Threads
- two y-axis in xy-plot
- combination xyplot and barchart?
- for loop question Documentation and its application for calculating euclidean distance on MDS ordination axis scores
- Function that is giving me a headache- any help appreciated (automatic read )
- matrix transformation into 3 columns II.