Multiple (7) Y axes?

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

Multiple (7) Y axes?

philip_rhoades
People,

I want to create seven plots on the one graph - each with it's own Y
axis and scale - I want the plots overlaid because it is the shape of
the graphs that I want to compare, not so much the values.  I have found
examples where people show how to put two Y axes on the left of the plot
but I couldn't find examples of any more than that - is it possible?

Thanks,

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW    2001
Australia
E-mail:  [hidden email]

______________________________________________
[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: Multiple (7) Y axes?

Thierry Onkelinx
Dear Philip,

If the values are not important, then you don't need different Y-axes. Why not standardise the seven datasets so they have a common scale?

Best regards,

Thierry

----------------------------------------------------------------------------
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium

Research Institute for Nature and Forest
team Biometrics & Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium

tel. + 32 54/436 185
[hidden email]
www.inbo.be

To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

> -----Oorspronkelijk bericht-----
> Van: [hidden email] [mailto:[hidden email]]
> Namens Philip Rhoades
> Verzonden: donderdag 16 juni 2011 11:12
> Aan: R help
> Onderwerp: [R] Multiple (7) Y axes?
>
> People,
>
> I want to create seven plots on the one graph - each with it's own Y axis and
> scale - I want the plots overlaid because it is the shape of the graphs that I want
> to compare, not so much the values.  I have found examples where people show
> how to put two Y axes on the left of the plot but I couldn't find examples of any
> more than that - is it possible?
>
> Thanks,
>
> Phil.
> --
> Philip Rhoades
>
> GPO Box 3411
> Sydney NSW    2001
> Australia
> E-mail:  [hidden email]
>
> ______________________________________________
> [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: Multiple (7) Y axes?

Jim Lemon
In reply to this post by philip_rhoades
On 06/16/2011 07:12 PM, Philip Rhoades wrote:
> People,
>
> I want to create seven plots on the one graph - each with it's own Y
> axis and scale - I want the plots overlaid because it is the shape of
> the graphs that I want to compare, not so much the values. I have found
> examples where people show how to put two Y axes on the left of the plot
> but I couldn't find examples of any more than that - is it possible?
>
Hi Phil,
You could do something like this by plotting the first plot, adding the
subsequent plots with "lines" or "points" and stacking the axes using
the "pos" argument that allows you to offset the axis.

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: Multiple (7) Y axes?

jannis-2
In reply to this post by philip_rhoades
Try something like:

par(mar=c(4,2,1,12),tcl=0.2,mgp=c(1,0,0))
plot(1:10,1:10)
for (i in 1:7)
{
    par(new=TRUE)
    plot(1:10,(i+(1:10)+rnorm(10,0,0.4)),yaxt='n',col=i,type='l')
    axis(4,line=(i-1)*1.5,col=i-1,col.ticks=i-1)
}

You may need to tweek around the options a bit and check that the tickmarks are actually labelling the correct axes and that the colors correspond....I did not check this thoroughly!


HTH
Jannis

--- Philip Rhoades <[hidden email]> schrieb am Do, 16.6.2011:

> Von: Philip Rhoades <[hidden email]>
> Betreff: [R] Multiple (7) Y axes?
> An: "R help" <[hidden email]>
> Datum: Donnerstag, 16. Juni, 2011 09:12 Uhr
> People,
>
> I want to create seven plots on the one graph - each with
> it's own Y axis and scale - I want the plots overlaid
> because it is the shape of the graphs that I want to
> compare, not so much the values.  I have found examples
> where people show how to put two Y axes on the left of the
> plot but I couldn't find examples of any more than that - is
> it possible?
>
> Thanks,
>
> Phil.
> -- Philip Rhoades
>
> GPO Box 3411
> Sydney NSW    2001
> Australia
> E-mail:  [hidden email]
>
> ______________________________________________
> [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: Multiple (7) Y axes?

philip_rhoades
Jannis,

Beautiful!  Thanks for the useful responses from others as well.

Regards,

Phil.


On Thu, 16 Jun 2011 12:49:58 +0100 (BST), Jannis wrote:

> Try something like:
>
> par(mar=c(4,2,1,12),tcl=0.2,mgp=c(1,0,0))
> plot(1:10,1:10)
> for (i in 1:7)
> {
>     par(new=TRUE)
>     plot(1:10,(i+(1:10)+rnorm(10,0,0.4)),yaxt='n',col=i,type='l')
>     axis(4,line=(i-1)*1.5,col=i-1,col.ticks=i-1)
> }
>
> You may need to tweek around the options a bit and check that the
> tickmarks are actually labelling the correct axes and that the colors
> correspond....I did not check this thoroughly!
>
>
> HTH
> Jannis
>
> --- Philip Rhoades <[hidden email]> schrieb am Do, 16.6.2011:
>
>> Von: Philip Rhoades <[hidden email]>
>> Betreff: [R] Multiple (7) Y axes?
>> An: "R help" <[hidden email]>
>> Datum: Donnerstag, 16. Juni, 2011 09:12 Uhr
>> People,
>>
>> I want to create seven plots on the one graph - each with
>> it's own Y axis and scale - I want the plots overlaid
>> because it is the shape of the graphs that I want to
>> compare, not so much the values.  I have found examples
>> where people show how to put two Y axes on the left of the
>> plot but I couldn't find examples of any more than that - is
>> it possible?
>>
>> Thanks,
>>
>> Phil.
>> -- Philip Rhoades
>>
>> GPO Box 3411
>> Sydney NSW    2001
>> Australia
>> E-mail:  [hidden email]
>>
>> ______________________________________________
>> [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.

--
Philip Rhoades

GPO Box 3411
Sydney NSW    2001
Australia
E-mail:  [hidden email]

______________________________________________
[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.