[R] 3 Y axis possible?
jim holtman
jholtman at gmail.com
Thu May 26 18:20:25 CEST 2011
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?
More information about the R-help
mailing list