[R] Multiple (7) Y axes?

Philip Rhoades phil at pricom.com.au
Thu Jun 16 19:16:41 CEST 2011


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 <phil at pricom.com.au> schrieb am Do, 16.6.2011:
>
>> Von: Philip Rhoades <phil at pricom.com.au>
>> Betreff: [R] Multiple (7) Y axes?
>> An: "R help" <r-help at stat.math.ethz.ch>
>> 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:  phil at pricom.com.au
>>
>> ______________________________________________
>> 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.
>>
>
> ______________________________________________
> 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.

-- 
Philip Rhoades

GPO Box 3411
Sydney NSW    2001
Australia
E-mail:  phil at pricom.com.au



More information about the R-help mailing list