Skip to content

Graphics?

3 messages · Yves Gauvreau, Paul Murrell

#
Hi,

Say I've setup a plot using layout which produce 2 rows x 1 column and I'm
using the same x values for both subplots.

Say for illustration that the top part is:

    plot(1:10, c(1,2,3,4,5,4,3,2,1,0), type="l")

and for the bottom I have:

    plot(1:10, c(5,4,3,2,1,2,3,4,5,6), type="l")

Now after the output of whatever function I use to draw this is done. What
I'd like to know is, is it possible to draw a line from (5, 1) on the bottom
part to (5,5) on the top part?

Assuming it's not possible, then could I at least do the line in 2 steps, I
mean draw from (5,1) to the top of the bottom part and from (5,5) to the
bottom of the top part. In other words can I add items such as lines or
points to a multi section drawing as we can on a single section drawing?

Thanks in advance.

Yves Gauvreau

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Hi
bottom
I
You do not have access to the coordinate systems in two different plots at
once so your first suggestion is not possible.

You can do your second suggestion as long as you add each part of the line
to the appropriate plot.  For example, ...
(Note the par=xpd makes sure that the lines are drawn outside the data
region)

Hope that helps

Paul


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
----- Original Message -----
From: "Paul Murrell" <paul at stat.auckland.ac.nz>
To: "Yves Gauvreau" <cyg at sympatico.ca>; <r-help at stat.math.ethz.ch>
Sent: Wednesday, November 08, 2000 3:23 PM
Subject: Re: [R] Graphics?
I'm
What
steps,
This is not quite what I had in mind.

It would be more in the lines of:

par(mfrow=c(2,1), xpd=T)
plot(1:10, c(1,2,3,4,5,4,3,2,1,0), type="l")
plot(1:10, c(5,4,3,2,1,2,3,4,5,6), type="l")

Now that I have my plots, the idea is to allow for example an interaction
between the user and the underlying "program" using maybe locator(),
identify() or other means to get some input and then as seems necessary draw
both lines in their respective frame or whatever it's called.

lines(c(5,5), c(5,-5) , "***** top *****")
lines(c(5,5), c(1,10), "***** bottom *****"))

The principle is exactly the same as I would do if I where using Matlab
subplots functionality. I wondered if I could use R to do similar things. I
know it's possible to work around this with sufficient work probably by
scaling every thing into a single plot region.

To resume, ounce I've plotted both the upper and bottom part like I
suggested, is it possible to access the top part again?

Thanks

YG
-.-.-
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._