summaryrefslogtreecommitdiffstats
path: root/grapheps.ps
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:36 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:36 -0800
commit5bea21e81ed516440e34e480f2c33ca41aa8c597 (patch)
tree653ace1b8fe0a9916d861d35ff8f611b46c80d37 /grapheps.ps
parent237c6e380aebdcbc70bd1c9ecf7d3f6effca2752 (diff)
downloadslib-upstream/3a4.tar.gz
slib-upstream/3a4.zip
Import Upstream version 3a4upstream/3a4
Diffstat (limited to 'grapheps.ps')
-rw-r--r--grapheps.ps18
1 files changed, 11 insertions, 7 deletions
diff --git a/grapheps.ps b/grapheps.ps
index 95f200e..db3b8b1 100644
--- a/grapheps.ps
+++ b/grapheps.ps
@@ -185,10 +185,12 @@ plotdict begin
/YSCL plotrect 3 get YRNG aload pop exch sub div def
/XOFF XOFF plotrect 0 get XSCL div sub def
/YOFF YOFF plotrect 1 get YSCL div sub def
- /YTSCL plotrect 3 get YRNG aload pop exch sub find-tick-scale def
- /YSTEP YTSCL 0 get 3 mod 0 eq {6} {8} ifelse 5 mul yuntrans def
- /XTSCL plotrect 2 get XRNG aload pop exch sub find-tick-scale def
- /XSTEP XTSCL 0 get 3 mod 0 eq {12} {10} ifelse 5 mul xuntrans def
+ /YTSCL plotrect 3 get YRNG aload pop exch sub abs find-tick-scale def
+ /YSTEP YTSCL 0 get 3 mod 0 eq {6} {8} ifelse 5 mul yuntrans
+ YSCL sign mul def
+ /XTSCL plotrect 2 get XRNG aload pop exch sub abs find-tick-scale def
+ /XSTEP XTSCL 0 get 3 mod 0 eq {12} {10} ifelse 5 mul xuntrans
+ XSCL sign mul def
/YSTEPH YSTEP 2 div def
/XSTEPH XSTEP 2 div def
} bind def
@@ -203,6 +205,8 @@ plotdict begin
/yuntrans {YTSCL aload pop exch div mul} bind def
/xuntrans {XTSCL aload pop exch div mul} bind def
+/sign {dup 0 lt {pop -1} {0 gt {1} {0} ifelse} ifelse} bind def
+
/zero-in-range? {dup 0 get 0 le exch 1 get 0 ge and} bind def
/y-axis
@@ -245,7 +249,7 @@ bind def
} bind def
% Given the width (or height) and the data-span, returns an array of
-% numerator and denominator (NUM DEN)
+% numerator and denominator [NUM DEN]
%
% NUM will be 1, 2, 3, 4, 5, 6, or 8 times a power of ten.
% DEN will be a power of ten.
@@ -256,9 +260,9 @@ bind def
/find-tick-scale
{/DLTA exch def /ISIZ exch def
/DEN 1 def
- {DLTA ISIZ le {exit} if /DEN DEN 10 mul def /ISIZ ISIZ 10 mul def} loop
+ {DLTA abs ISIZ le {exit} if /DEN DEN 10 mul def /ISIZ ISIZ 10 mul def} loop
/NUM 1 def
- {DLTA 10 mul ISIZ ge {exit} if /NUM NUM 10 mul def /DLTA DLTA 10 mul def} loop
+ {DLTA abs 10 mul ISIZ ge {exit} if /NUM NUM 10 mul def /DLTA DLTA 10 mul def} loop
[[8 6 5 4 3 2 1] {/MAX exch def MAX DLTA mul ISIZ le {MAX exit} if} forall
NUM mul DEN]
} bind def