[R] how to prevent lattic barchart from drawing bar completely to the bottom/left of the chart
Dan Kortschak
dan.kortschak at adelaide.edu.au
Mon Nov 23 01:04:26 CET 2009
Hello,
I am trying to use lattice barchart so that it will draw a barplot where
the bars do no reach the frame of the chart, but only extend to 0 as the
minimum. With barplot, I can set this by using the offset value, but I
cannot see how to do this with barchart.
Using the example in the barchart help:
barchart(yield ~ variety | site, data = barley,
groups = year, layout = c(1,6),
ylab = "Barley Yield (bushels/acre)",
scales = list(x = list(abbreviate = TRUE,
minlength = 5)))
I could add ylim=c(0,max(barley$yield)*1.1) as a term, but I want to
keep the origin bars slightly above the axis, just not extending to it.
Purely by way of demonstration of what I mean by this (the chart is
obviously meaningless), the result of
barchart(cbind(as.vector(barley$yield), as.vector(barley$yield)),
horizontal=FALSE, groups=FALSE,layout=c(1,2))
is what I would like to see at the bottoms of the bars.
Can anyone suggest what to add?
thanks
Dan
More information about the R-help
mailing list