From p.dalgaard@biostat.ku.dk  Mon Jul 23 12:27:23 2001
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 23 Jul 2001 13:27:23 +0200
Subject: [Rd] hang-up with log="x" and segments (PR#1030)
In-Reply-To: sc@paracelsus.fdm.uni-freiburg.de's message of "Mon, 23 Jul 2001 12:57:59 +0200 (MET DST)"
References: <200107231057.MAA19791@pubhealth.ku.dk>
Message-ID: <x2ae1vj36s.fsf@blueberry.kubism.ku.dk>

sc@paracelsus.fdm.uni-freiburg.de writes:

> I experienced the following problem with R 1.3.0 which is probably a
> bug. The program hangs-up if 1.) a coordinate of segments is outside the
> ploting region and 2.) the option log="x" is used.
> 
> ##
> ## works fine
> ##
> plot(1,1, xlim=c(0.5, 2), ylim=c(0.5, 2))
> segments(0.5 , 1.2, 1, 0.6)
> segments(0.25, 1.2, 1, 0.6)
> segments(1   , 1.2, 1, 0.6)
> 
> ##
> ## hang-up
> ##
> plot(1,1, xlim=c(0.5, 2), ylim=c(0.5, 2), log="x")
> segments(0.5 , 1.2, 1, 0.6)
> segments(0.25, 1.2, 1, 0.6)
> segments(1   , 1.2, 1, 0.6)

Confirmed on Linux, but seems to have disappeared in the patched
version. Not sure what caused the fix, though... My guess would be
that it is this change in CSclipline:

@@ -2464,6 +2466,7 @@
     yb = cr->yb;
     yt = cr->yt;
     if (dd->gp.xlog || dd->gp.ylog) {
+       double temp;
 
        GConvert(x1, y1, coords, NDC, dd);
        GConvert(x2, y2, coords, NDC, dd);
@@ -2475,6 +2478,17 @@
        cr2.yb = yb;
        cr2.yt = yt;
 
+        if (cr2.xr < cr2.xl) {
+            temp = cr2.xl;
+            cr2.xl = cr2.xr;
+            cr2.xr = temp;
+        }
+        if (cr2.yt < cr2.yb) {
+            temp = cr2.yb;
+            cr2.yb = cr2.yt;
+            cr2.yt = temp;
+        }
+
        x = xl;         /* keep -Wall happy */
        y = yb;         /* keep -Wall happy */
        while( c1 || c2 ) {


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] hang-up with log="x" and segments (PR#1030)
Peter Dalgaard BSA