[R] Plot availability

john crepezzi seejohnrun at gmail.com
Fri Sep 19 20:00:22 CEST 2008

I'm not so sure the original way I stated my issue was clear enough,
so I'll attempt to elaborate a little bit.

I'd like to make a function that is passed the name of a plot object,
and a lines/point specification, and graphs them all on the same plot.

I don't want to redraw the plot each time, and I don't want the code
to have any concept of a "first entry" instantiating the plot with
plot() in place of lines().

Ideally, I'd like something to the effect of:

plot <- createPlot(main = "Hello World", sub = "tiny, little world",
xlim = c(-3, 3), ylim = c(-3, 3))

plot <- addElement(plot, lines(col = 'BLUE', x = c(0, 1, 2, 3), y =
c(3, 2, 1, 0)))

Hopefully this laid my problem out a little better.

Thanks in advance for any help you might be able to offer
-John Crepezzi

On Sep 19, 10:11 am, Duncan Murdoch <murd... at stats.uwo.ca> wrote:
> On 9/19/2008 9:32 AM, john crepezzi wrote:
> > Is it possible to see if a plot is already open before I call lines()?
> I don't think so.  You can see if a graphics device is open by looking
> at dev.cur(), but I don't think there's a test for plot.new().  I'd just
> wrap the call in try() if you're not sure it will work.
> Duncan Murdoch
> ______________________________________________
> R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list