[R] combining bar and line plots with multiple axes
Greg.Snow at imail.org
Thu Oct 2 18:19:51 CEST 2008
The updateusr function in the TeachingDemos package can be used to change the user coordinates of the current plot and may do what you want.
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
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 Schreiber, Stefan
> Sent: Thursday, October 02, 2008 10:04 AM
> To: r-help at r-project.org
> Subject: [R] combining bar and line plots with multiple axes
> Hey list,
> I have a barplot with a line plot overlayed (on the 2nd y axis) and it
> looks fine except that the origin (0) on the 2nd y axis (side=4) is
> lining up with the origin on the 1st y-axis (side=2, from the barplot).
> Is there a way to either shift the 2nd y-axis (line plot) down or
> readjust the barplot axis?
> Just as a reference, here is the code:
> barplot2(temp$precip, names.arg=temp$year, ylim=c(0,300),axes=F)
> plot(temp$year, temp$mat, axes=F, type="l", ylim=(0,25))
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help