Skip to content
Prev 132631 / 398506 Next

adding lines to a barchart

On 12/21/07, Spilak,Jacqueline [Edm] <Jacqueline.Spilak at ec.gc.ca> wrote:
Sure, just use Year as a grouping variable as well.

barchart(percent_below ~ factor(Year) | factor(season, levels=unique(season)),
         data = dataset1, layout = c(4, 1),
         groups = factor(Year),
         auto.key = list(points = FALSE, rectangles = TRUE),
         stack = TRUE,
         upper_2007 = c(6, 4, 5, 3),
         panel = function(..., upper_2007) {
             panel.abline(h = upper_2007[packet.number()])
             panel.barchart(...)
         })
What exactly do you want to happen? I don't think a bar chart is an
appropriate visualization unless the lengths of the bars mean
something. If it does, and you just want to get rid of the space below
zero, the easiest way is to set an explicit ylim=c(0, 7) or something.
If the lengths don't really mean anything, you should consider using
dotplot() instead.

-Deepayan