if/else for plot/lines?
The simplest way would be to have a flag, an indicator variable that
stores a value that indicates if a plot has been done before. Something
like this
plot (do my first plot here...)
is.plot=T
.... later in the code...
if (is.plot) {plot (do new plot here)} else {lines(add lines to the
previous plot)}
Julian
Roger Levy wrote:
I'm interested in writing a function that constructs a new plot on the current graphics device if no plot exists there yet, but adds lines to the existing plot if a plot is already there. How can I do this? It seems to me that the exists() function might be co-opted to do this, but it's not obvious how. Many thanks, Roger
Julian M. Burgos Fisheries Acoustics Research Lab School of Aquatic and Fishery Science University of Washington 1122 NE Boat Street Seattle, WA 98105 Phone: 206-221-6864