[R] Lattice - different axis length
David Winsemius
dwinsemius at comcast.net
Tue Feb 7 15:12:40 CET 2012
On Feb 7, 2012, at 6:42 AM, Florian Weiler wrote:
> Dear all,
>
> I have a question about the lattice package, more specifically about
> the
> control of the x-axis length in the different panels. I use the
> following
> code to make the stacked barchart:
>
> barchart(country ~ climatechangefocalpoint + meteorologyservice +
> adaptationorvulnerability + cdmcarbonmarkets + energy +
> aviationmaritimetransport + forestry + pressofficer|period,
> data=graph5,
> as.table=T,
> xlim=c(0,150),
> layout=c(3,1),
> par.strip.text=list(cex=1.5),
> scales = list(alternating = 3, cex=1.2, tick.number=5),
> xlab="",
>
> col
> =
> c
> ("grey15
> ","grey75","grey30","grey90","grey45","grey0","grey60","grey100"),
> #col=c(grey(100:1/100), grey(50:1/100), grey(0:1/100)),
> stack=T)
>
> Unfortunately, in the first two periods there are much less data,
> hence the
> bars are much shorter in those two panels and most of the space is
> unused,
> as the axis still run to 150 as for the last panel. Does anyone know
> how to
> cut the x-axis for the first two panels at, say, 50, while leaving
> it for
> the third panel as it is? Google and looking through old
> conversations here
> didn't help me, so I'm not quite sure whether this is possible at all.
in the scales list you could add: y=list(relation="free")
?xyplot and look at the relation sub-section in the scales section for
more information.
>
> Thanks and best,
> Florian
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Lattice-different-axis-length-tp4364450p4364450.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list