Re: [R] 3 Y axis possible?

From: jim holtman <jholtman_at_gmail.com>
Date: Thu, 26 May 2011 12:20:25 -0400

Try this:

plot(x$Time, x$y1, type='l', bty = 'c', col = 'red') par(new = TRUE)
plot(x$Time, x$y2, type = 'l', axes = FALSE, xlab = '', ylab = '', col = 'green')
axis(4, col='green')
par(new = TRUE)
plot(x$Time, x$y3, type = 'l', axes = FALSE, xlab = '', ylab = '', col = 'blue') axis(4, col='blue', line = -3)

You have to not plot the axises on the secondary plots.

On Thu, May 26, 2011 at 12:11 PM, Jun Shen <jun.shen.ut_at_gmail.com> wrote:
> Hi, Jim,
>
> Thanks for the information. But I am still not clear how to show the 3
> separated Y axis. If I just call par(new=TRUE), the three axes are
> overlapped.
>
> attached some test data. Thanks.
>
> Jun
> =========================================================================
>
> structure(list(Time = 1:10, y1 = c(1000, 900, 810, 729, 656.1,
> 590.49, 531.441, 478.2969, 430.46721, 387.420489), y2 = c(10,
> 8, 6.4, 5.12, 4.096, 3.2768, 2.62144, 2.097152, 1.6777216, 1.34217728
> ), y3 = c(0.1, 0.075, 0.05625, 0.0421875, 0.031640625, 0.02373046875,
> 0.0177978515625, 0.013348388671875, 0.0100112915039063, 0.00750846862792969
> )), .Names = c("Time", "y1", "y2", "y3"), class = "data.frame", row.names =
> c(NA,
> -10L))
>
> On Thu, May 26, 2011 at 10:49 AM, jim holtman <jholtman_at_gmail.com> wrote:
>>
>> There is nothing to prevent you from putting 3 y-axis on your plot;
>> might be confusing, but it can be done.  What have you tried and why
>> do you say "guess not"?  With the use of par(new=TRUE) or by doing
>> your own scaling, you can use 'axis' to put as many axises as you want
>> on your graph.
>>
>> On Thu, May 26, 2011 at 11:35 AM, Jun Shen <jun.shen.ut_at_gmail.com> wrote:
>> > Dear list,
>> >
>> > We have three time course profiles with very different scales, and we
>> > want
>> > to show them in one plot. Is it possible to have three y axis? I guess
>> > not,
>> > then what would be other options? something like two 2-y axis plots on a
>> > three dimensional view? Appreciate any comment.
>> >
>> > Jun Shen
>> >
>> >        [[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 Holtman
>> Data Munger Guru
>>
>> What is the problem that you are trying to solve?
>
>

-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?

______________________________________________
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.
Received on Thu 26 May 2011 - 16:23:57 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 26 May 2011 - 17:50:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive