[R] How to add two different axis to one plot?

Andrew Robinson A.Robinson at ms.unimelb.edu.au
Mon Jan 30 04:56:56 CET 2006


Use the axis() command to add custom axes.

To "hold" the plot, insert

par(new=TRUE)

between the plot statements, thus:

plot(x1, y1, etc ...)
par(new=TRUE)
plot(x2, y2, etc ...)



Andrew

On Mon, January 30, 2006 2:49 pm, Michael said:
> Hi all,
>
> I need to put two different axis to one plot. On the top of the plot, I
> need
> to put one axis, with increments from left side to the right side; then at
> the bottom of the same plot, I need to put another axis, with increments
> from right side to the left side and showing a different unit. How do I do
> that?
>
> By the way, is there a "hold" command for plotting?
>
> If I first plot a picture, how to add another "plot" command onto it
> without
> erasing it?
>
> In matlab, it can be convinient done by "hold on" and "hold off"... and
> can
> I do it in R?
>
> Thanks a lot,
>
> Micheal
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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
>


Andrew Robinson
Senior Lecturer in Statistics                       Tel: +61-3-8344-9763
Department of Mathematics and Statistics            Fax: +61-3-8344 4599
University of Melbourne, VIC 3010 Australia
Email: a.robinson at ms.unimelb.edu.au    Website: http://www.ms.unimelb.edu.au




More information about the R-help mailing list