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

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Shane Carey
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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: cumulative frequency distribution combined with histogram in one plot at two different scales

Adams, Jean
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 <[hidden email]> 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]]
>
> ______________________________________________
> [hidden email] 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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: cumulative frequency distribution combined with histogram in one plot at two different scales

arun kirshna
In reply to this post by Shane Carey


Hi,

May be you can try ?twoord.plot from library(plotrix)
A.K.


On Tuesday, May 20, 2014 9:41 AM, Shane Carey <[hidden email]> 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]]

______________________________________________
[hidden email] 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.


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: cumulative frequency distribution combined with histogram in one plot at two different scales

Jim Lemon
In reply to this post by Shane Carey
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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: cumulative frequency distribution combined with histogram in one plot at two different scales

Shane Carey
Hi all,

I ended up using twoord.plot from library(plotrix)
It worked great. Thanks for all the help.
Cheers


On Wed, May 21, 2014 at 8:15 AM, Jim Lemon <[hidden email]> wrote:

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


--
Shane

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.