Skip to content
Prev 132629 / 398506 Next

adding lines to a barchart

Thanks Deepayan, this helped a lot and gave me exactly what I wanted
however I want a few changes and am not sure how to do them.  In each
panel the bars for the years are the same color with the bottom axis
(the x-axis) labelled with the years.  I would like each year to have a
specific color with a legend for it at the side, is this possible?
And my other question is that there seems to be a gap between where the
bars start and the x-axis, it is kinda funny looking so is there anyway
to change this?
Thanks for all the help
On 12/19/07, Spilak,Jacqueline [Edm] <Jacqueline.Spilak at ec.gc.ca> wrote:
I would suggest a slightly different format. Here's an example with one
set of limits; you can add another set similarly. If you really want a
single panel, you could use panel.segments().

barchart(percent_below ~ factor(Year) | factor(season,
levels=unique(season)),
         data= dataset1, origin = 0, layout = c(4, 1),
         upper_2007 = c(6, 4, 5, 3),
         panel = function(..., upper_2007) {
             panel.abline(h = upper_2007[packet.number()])
             panel.barchart(...)
         })

-Deepayan