# [R] Odp: x axis problems

From: Petr PIKAL <petr.pikal_at_precheza.cz>
Date: Mon, 14 May 2007 14:57:08 +0200

Hi

r-help-bounces_at_stat.math.ethz.ch napsal dne 14.05.2007 13:45:25:

> I have been searching for the R manual, unable to solve my problem.
>
> Questions
>
> 1) How can I put the x axis at the top of the plot?

see ?axis

>
> 2) I am plotting data from a CTD. I want to add series sal, obs and fluo
> at the same plot by using points(sal,deepth) ets. The data have
> different values so I want to use multiple x axis (4) with different
> scaling. How can I do that?
>
>
plot(sal,depth,ylim=c(100,0),xlim=c(-0.0120,62),type="l",col.axis="",xaxt="s",xlab="")
> points(temp,depth,type="l",col="red")
> points(obs,depth,type="l",col="green")
> points(fluo,depth,type="l",col="blue")

Strange, usually people want multiple y axes.

Maybe you could look at setting 4 panels for plotting e.g.

par(mfrow=c(2,2))

If you insist on plotting 4 lines with 4 x axes into one plot then you need to make some adjustment prior plotting. You shall scale sal, temp, obs and fluo into some comparable figures e.g. to 0-1 and after plotting you need to add 4 axes with correct numbers (see at parameter). Adding 2 x axes (top and bottom) is strightforward, however adding next 2 x axes seems to be tricky (you probably need to use combination of lines and segments).

Regards
Petr

>
> Thank you for any help!
>
> Ener Borg
>
> ______________________________________________
> R-help_at_stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

R-help_at_stat.math.ethz.ch 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 Mon 14 May 2007 - 13:07:16 GMT

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 Mon 14 May 2007 - 13:31:18 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.