Skip to content

hang-up with log="x" and segments (PR#1030)

3 messages · sc@paracelsus.fdm.uni-freiburg.de, Peter Dalgaard, Paul Murrell

#
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)


platform sparc-sun-solaris2.8
arch     sparc               
os       solaris2.8          
system   sparc, solaris2.8   
status                       
major    1                   
minor    3.0                 
year     2001                
month    06                  
day      22                  
language R                   

Obviously, a work-around is to ensure that segments falls within the
ploting region. 

Best regards,
#
sc@paracelsus.fdm.uni-freiburg.de writes:
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 ) {
#
Hi
Yep, that went in during the fix-so-far to bug#997.

Paul


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