[R] lattice barchart() with two variables
r@hep@rd @end|ng |rom @pp|-eco@y@@com
Fri Aug 24 23:28:49 CEST 2018
On Fri, 24 Aug 2018, Bert Gunter wrote:
> For the legend, you can use the full "key" argument for more control.
This I did.
> For the scales, again, the docs provide the answer: the "at" and "labels"
> components of "x" component of the scales lists can explicitly control the
> x -labels, e.g.
A bit of trial-and-error got this working, too. Now the plot command works
barchart(value ~ year, data=stage_heights,
panel = lattice.getOption("panel.barchart"),
default.prepanel = lattice.getOption("prepanel.default.barchart"),
box.ratio = 2, horizontal=FALSE, key=list(c(0.2,0.3), columns=2,
col = c('grey','black'), scales=list(x=list(at=rep(1:29),
main = 'Median and Maximum Stage Heights',
ylab = 'Elevation (masl)', xlab = 'Year')
(Emacs w/ESS does the formatting). I suppose that the Maximum bar is plotted
to the left because alphabetically it preceeds Medium. I can live with this.
Deepayan's book was one of the first I bought years ago. I've not before
had plots that required more in-depth knowledge of panels, keys, and scales
so I do appreciate your patient mentoring.
More information about the R-help