[R] Automatic adjustment of axis ranges

Mike Lonergan mel at mcs.st-and.ac.uk
Fri Jul 19 17:30:23 CEST 2002


Jim,

I was vaguely thinking about this as well. I thought the easiest way might
be to modify plot() to return an invisible list of its variables. Something
like:

    invisible(list(list(xy=xy, type=type, col = col, pch = pch, cex = cex,
bg = bg,
        lty = lty, lwd = lwd)))

Then write a plot.update(plot.list, normal_plot_stuff:x,y,type,etc)
that sets the xlim & ylim to the max required, redraws everything including
newstuff, and extends the list.

This is slightly inefficient in terms of memory usage etc, but such an
approach would permit an option to choose whether to use the saved original
values or any more recent modified ones that might be kicking around.

Something might be needed to handle "..." parameters, but I don't know what.

I haven't yet written the function because I'm so embarrassingly far behind
on what I am actually paid to do! (I'm not asking anyone else to do it, just
offering the thought to those interested & awaiting the reasons its a
foolish one.)

Cheers,

Mike.


     > -----Original Message-----
     > From: owner-r-help at stat.math.ethz.ch
     > [mailto:owner-r-help at stat.math.ethz.ch]On Behalf Of Jim Lemon
     > Sent: 19 July 2002 13:06
     > To: R-help at stat.math.ethz.ch
     > Subject: Re: [R] Automatic adjustment of axis ranges
     >
     >
     > I had a look at this, and worked out most of a function to
     > do it. There
     > are three things I haven't been able to figure out, however.
     >
     > 1) Getting the last N lines of the command history into a vector of
     > strings. I thought something like:
     >
     > last.commands<-history(N)
     >
     > would work, but no go. There doesn't seem to be a file that
     > I can tail,
     > either.
     >
     > 2) Finding continuation lines by parenthesis matching. I
     > thought this
     > would be easy, but split() doesn't seem to do what the help
     > file says, viz.
     > "...in particular if split has length 0, x is split into single
     > characters." Trying the following:
     >
     > split("abc","")
     >
     > I get:
     >
     > [[1]]
     > [1] "abc"
     >
     > not:
     >
     > [1] "a" "b" "c"
     >
     > 3) Once I have the last plot command as a string, suitably modified,
     > getting it to run.
     >
     > Any suggestions?
     >
     > Jim
     > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
     > .-.-.-.-.-.-.-.-.-
     > 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
     > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
     > ._._._._._._._._._

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



More information about the R-help mailing list