ripley@stats.ox.ac.uk
2001-Jan-30 07:40 UTC
[Rd] screen can't go back to log="y" plot (PR#831)
[I have abbreviated the subject as jitterbug has been having probems with long subjects.] The issue here is that one cannot mix log/non-log axes in the calls to screen(), as the appropriate par() parameter is read-only, but the meaning of yaxp depends on it. But beyond that you can't set x/yaxp for log axes. You should be able to do this: you can in the S original. A simpler version: plot (1:2, 1:2, log="y", main="1") zz <- par("yaxp") zz [1] 1 2 -5 par(yaxp=zz) Error in par(yaxp = zz) : invalid value specified for graphics parameter "yaxp". So you can't reset the yaxp parameter to what it is reported as! Additional bug: the meaning of x/yaxp for log axes is not defined in help(par). On Tue, 30 Jan 2001 tov@ece.cmu.edu wrote:> > Hi. Let's try to explain the subject line with some code: > > > split.screen (c(2,1)) > [1] 1 2 > > screen(1) > > plot (1:2, 1:2, log="y", main="1") > > screen (2) > > plot (1:2, 1:2, main="2") > > screen (1) > Error in par(.split.screens[[n]]) : invalid value specified for graphics parameter "yaxp". > > close.screen(all=TRUE) > > Let's add comments: > > > split.screen (c(2,1)) > [1] 1 2 > > OK, plot in the top half screen: > > screen(1) > > plot (1:2, 1:2, log="y", main="1") > > par("yaxp") > [1] 1 2 -5 > > OK, switch to bottom half: > > screen (2) > > plot (1:2, 1:2, main="2") > > par("yaxp") > [1] 1 2 5 > > OK, looks fine, let's go back up: > > screen (1) > Error in par(.split.screens[[n]]) : invalid value specified for graphics parameter "yaxp". > > Bummer. > > close.screen(all=TRUE) > > Somehow I'm hoping you'll tell me I'm doing something wrong, because > I'd really would like to be able to do the following: > repeat { > #calculate > screen(1) > #fancy plot > screen (2) > #even fancier plot ;-) > if (user.bored()) break > } > Which is roughly what I was doing when the error messages started > popping up. > > Thanks, > -tom > > --please do not edit the information below-- > > Version: > platform = i386-pc-linux-gnu > arch = i386 > os = linux-gnu > system = i386, linux-gnu > status > major = 1 > minor = 2.1 > year = 2001 > month = 01 > day = 15 > language = R > > Search Path: > .GlobalEnv, package:ctest, Autoloads, package:base > > > > -- > mailto:tov@ece.cmu.edu (Tom Vogels) Tel: (412) 268-6638 FAX: -3204 > > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-devel 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-devel-request@stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Prof Brian D Ripley <ripley@stats.ox.ac.uk> writes:> [I have abbreviated the subject as jitterbug has been having probems > with long subjects.] > > The issue here is that one cannot mix log/non-log axes in the calls to > screen(), as the appropriate par() parameter is read-only, but the > meaning of yaxp depends on it. But beyond that you can't set > x/yaxp for log axes. > > You should be able to do this: you can in the S original. > > A simpler version: > > plot (1:2, 1:2, log="y", main="1") > zz <- par("yaxp") > zz > [1] 1 2 -5 > par(yaxp=zz) > Error in par(yaxp = zz) : invalid value specified for graphics parameter > "yaxp". > > So you can't reset the yaxp parameter to what it is reported as![snip] The code in main/par.c ignores the value of xlog (or ylog) when setting xaxp (or yaxp). Right now you have in Specify (and Specify2): ... else if (streql(what, "xaxp")) { value = coerceVector(value, REALSXP); lengthCheck(what, value, 3); naRealCheck(REAL(value)[0], what); naRealCheck(REAL(value)[1], what); posIntCheck((int) (REAL(value)[2]), what); Shouldn't that be something like: ... else if (streql(what, "xaxp")) { value = coerceVector(value, REALSXP); lengthCheck(what, value, 3); naRealCheck(REAL(value)[0], what); naRealCheck(REAL(value)[1], what); if (dd->gp.xlog) logAxpCheck((int) (REAL(value)[2]), what); else posIntCheck((int) (REAL(value)[2]), what); Where logAxpCheck is suitably defined as: static void logAxpCheck(int x, char *s) { if (x == NA_INTEGER || x == 0 || x > 4) par_error(s); } since only values < 0 or the values 1, 2, 3 are allowed?> Additional bug: the meaning of x/yaxp for log axes is not defined > in help(par).excerpt from help(par): xaxp: A vector of the form `c(x1, x2, n)' giving the coordinates of the extreme tick marks and the number of intervals between tick-marks. Could you add: The value of n must be positive for linear scale axes. For logarithmic scale axes n must be either negative (then there will be (1-n) ticks at a linear distance) or one of 1, 2, or 3 where n then indicates the number of ticks per decade. similar for yaxp? What am I missing? Regards, -tom -- mailto:tov@ece.cmu.edu (Tom Vogels) Tel: (412) 268-6638 FAX: -3204 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._