Shane Carey
2014-May-20 13:39 UTC
[R] cumulative frequency distribution combined with histogram in one plot at two different scales
Hi, I amtrying to plot a cfd with a histogram on one plot. The problem is the scale (y-axis) of the plots are hugely different and as a result the histogram plot is hard to read. Are there any examples of plots like this done in R: http://ej.iop.org/images/0952-4746/32/3/325/Full/jrp428239f9_online.jpg Thanks -- Shane [[alternative HTML version deleted]]
Adams, Jean
2014-May-20 21:19 UTC
[R] cumulative frequency distribution combined with histogram in one plot at two different scales
Shane, Do you have code to create each plot separately? If so, you can use par(new=TRUE) to overlay a second plot over the first with a different y-axis scale. See, for example, http://robjhyndman.com/hyndsight/r-graph-with-two-y-axes/ Jean On Tue, May 20, 2014 at 8:39 AM, Shane Carey <careyshan@gmail.com> wrote:> Hi, > > I amtrying to plot a cfd with a histogram on one plot. The problem is the > scale (y-axis) of the plots are hugely different and as a result the > histogram plot is hard to read. Are there any examples of plots like this > done in R: > > http://ej.iop.org/images/0952-4746/32/3/325/Full/jrp428239f9_online.jpg > > Thanks > > > > -- > Shane > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. >[[alternative HTML version deleted]]
arun
2014-May-21 01:52 UTC
[R] cumulative frequency distribution combined with histogram in one plot at two different scales
Hi, May be you can try ?twoord.plot from library(plotrix) A.K. On Tuesday, May 20, 2014 9:41 AM, Shane Carey <careyshan at gmail.com> wrote: Hi, I amtrying to plot a cfd with a histogram on one plot. The problem is the scale (y-axis) of the plots are hugely different and as a result the histogram plot is hard to read. Are there any examples of plots like this done in R: http://ej.iop.org/images/0952-4746/32/3/325/Full/jrp428239f9_online.jpg Thanks -- Shane ??? [[alternative HTML version deleted]] ______________________________________________ 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.
Jim Lemon
2014-May-21 07:15 UTC
[R] cumulative frequency distribution combined with histogram in one plot at two different scales
On Tue, 20 May 2014 02:39:17 PM Shane Carey wrote:> Hi, > > I amtrying to plot a cfd with a histogram on one plot. The problem isthe> scale (y-axis) of the plots are hugely different and as a result the > histogram plot is hard to read. Are there any examples of plots likethis> done in R: > >http://ej.iop.org/images/0952-4746/32/3/325/Full/jrp428239f9_online.jpg>Hi Shane, Try this: mmp<-c(4,23,38,33,6,6,6,2,1,0,1,0) cmmp<-cumsum(mmp) dft<-seq(0,550,by=50) library(plotrix) twoord.plot(lx=dft,ly=mmp,rx=dft,ry=cmmp, type=c("bar","b"),halfwidth=25,lcol=NA) Jim