[R] cumulative frequency distribution combined with histogram in one plot at two different scales

Jim Lemon jim at bitwrit.com.au
Wed May 21 09:15:49 CEST 2014


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 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
> 
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



More information about the R-help mailing list