[R] Adding line plot to a barplot
Greg Snow
Greg.Snow at imail.org
Mon Feb 1 19:15:26 CET 2010
Instead of using par(new=T), use the lines function instead of plot to add to an existing plot.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Nadine Kilsby
> Sent: Sunday, January 31, 2010 11:41 PM
> To: r-help at r-project.org
> Subject: [R] Adding line plot to a barplot
>
> Hi,
> I am trying to add a line plot of barplot, and while the following
> script
> works:
>
> barplot(DATA1,bty='c')
> par(new=T)
> plot(DATA2,type="l",axes=F,xlab="",ylab="",bty='c')
> axis(4)
>
> for some reason the y axis' do not align (the 0s are not in the same
> position). Is this because I am trying to overlay plot on barplot, and
> is
> there any way around this?
> Thanks,
> Nadine
>
> ______________________________________________
> 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