[R] Alignment of lines within barplot bars

Greg Snow Greg.Snow at imail.org
Fri Apr 8 18:23:37 CEST 2011

Look at the updateusr function in the TeachingDemos package.

Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of snowboarder101
> Sent: Thursday, April 07, 2011 12:38 PM
> To: r-help at r-project.org
> Subject: Re: [R] Alignment of lines within barplot bars
> Hi,
> I am dealing with a similar issue, I am trying to use a barplot in
> conjunction with some points plotted and want to line the two up. This
> all
> works fine, but I am dealing with the additional complication that I
> have
> two y-ranges. The barplot is based on one range, while the points are
> based
> on another. The way I have been dealing with this is to use barplot(),
> and
> then use a par(new=T), and then do the plot. So I have axis(2) with the
> points, and axis(4) with the barplot values. However, the points don't
> line
> up. When I do it the other way and do barplot(), points() with the
> barplot()
> x coordinates, the range isn't correct, and not all points appear.
> I can force barplot() to use my range of points, but then the bars are
> too
> small. I can also try to normalize my points to be in the same range as
> the
> barplot() data, but then I have issues labeling it appropriately. That
> is,
> my axis(2) is incorrect, and I need this whole thing to function
> dynamically
> in a function, so I can't explicitly list the labels.
> Any thoughts on this would be appreciated.
> --
> View this message in context: http://r.789695.n4.nabble.com/Alignment-
> of-lines-within-barplot-bars-tp2533115p3434209.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.

More information about the R-help mailing list