[R] Multi-line plots with matrices in R

Joseph Wakeling joseph.wakeling at webdrake.net
Wed Mar 7 16:11:44 CET 2007


Gavin Simpson wrote:
> You want maplot here. See ?matplot  but here is an example:

Great!  Thanks to you and Petr for pointing this out, it's exactly what
I wanted.  Petr's other suggestions look interesting and I'll explore
them at length later.

> Note the changed axis range in the right-hand margin. The problem is
> that you can't use plot.window to achieve what you want, not that
> plot.window doesn't do anything.

Ahhh, I see.  So, it does not affect what has already been plotted, but
affects how new material is inserted into the plot area.  Entering

plot.window(xlim=c(0,100),ylim=c(0,0.5))
axis(1)
axis(2)
plot.window(xlim=c(0,100),ylim=c(0,1))
axis(2)

... is instructive. :-)

So, _is_ there a command which will rearrange the existing plotted
items, including axes?  Or does R require that I have a good idea of the
space in which I want to plot from the start?

Oh, and a quick cosmetic query---I notice that the axes when created are
spaced apart somewhat so the axis lines do not meet at the plot origin.
 Is there a way to alter this so that the outline of the box, and the
extreme values of the axis, match up?

Thanks again,

    -- Joe



More information about the R-help mailing list