[R] Graphics?

Paul Murrell paul at stat.auckland.ac.nz
Wed Nov 8 21:23:43 CET 2000

```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?

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, ...

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

(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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```