diff --git a/pub/share/g3.ps b/pub/share/g3.ps index 9f78eac17ec5cf11a552e3caf8f1cdbd127f6cfb..cca32fdef830d221d6e7624aeb00d1634e0f3112 100644 --- a/pub/share/g3.ps +++ b/pub/share/g3.ps @@ -1,4 +1,4 @@ -WuGdict10a begin %% the following lines are produced by g3.ps +WuGdict11a begin %% the following lines are produced by g3.ps %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% @@ -15,7 +15,7 @@ EdgeLeftDIN 0 0 InfSet % plot fnam, info 1 dup 2 SymGSet % slin srad serr(2=from pset) : graph symbols, global preset -/EndFrame { plotafter Basta } def +/EndFrame { plotafter showpage end } def % /setboxbackgroundcolor { 0.93 setgray } def % x y 24 abcset diff --git a/pub/share/wups11a.ps b/pub/share/wups11a.ps index 0370b42065455a9ad555e61424bdc444ad80dab9..cecce89c5f2a5d49e390ffeb032f9f12d54dd8e7 100644 --- a/pub/share/wups11a.ps +++ b/pub/share/wups11a.ps @@ -1,32 +1,21 @@ %!PS-Adobe-2.0 -gsave -/WuGdict11a 400 dict def -WuGdict11a begin +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% FRIDA: flexible rapid interactive data analysis %% +%% wups11a.ps: graphic macros %% +%% (C) Joachim Wuttke 1990-2011 %% +%% http://www.messen-und-deuten.de/frida %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Extend font encoding -% thanks to http://www.itp.uni-hannover.de/~zawischa/ITP/proPS.html 26apr11 - -/ReEncode { % OldFont NewFont Encoding | - /MyEncoding exch def - exch - findfont % select OldFont - dup length dict begin - {def} forall - /Encoding MyEncoding def - currentdict - end - definefont % define as NewFont -} def -% To use this, image scripts must be Latin1 encoded +%% Framework: -/Helvetica /HelveticaLatin1 ISOLatin1Encoding ReEncode -/Helvetica-Oblique /HelveticaLatin1-Oblique ISOLatin1Encoding ReEncode -/Helvetica-Bold /HelveticaLatin1-Bold ISOLatin1Encoding ReEncode -/Helvetica-BoldOblique /HelveticaLatin1-BoldOblique ISOLatin1Encoding ReEncode +% For interleaving applications, isolate what follows in a dictionary +/WuGdict11a 400 dict def +WuGdict11a begin -%% shortwords : + +%% Shortcuts: /np {newpath} bind def /mv {moveto} bind def @@ -47,34 +36,104 @@ WuGdict11a begin /G { gsave exec grestore } bind def -%% generic operators : + +%% Fonts: + +% extend font encoding +/ReEncode { % OldFont NewFont Encoding | - + /MyEncoding exch def + exch + findfont % select OldFont + dup length dict begin + {def} forall + /Encoding MyEncoding def + currentdict + end + definefont % define as NewFont +} def + +% we assume that image scripts are Latin1 encoded +/Helvetica /HelveticaLatin1 ISOLatin1Encoding ReEncode +/Helvetica-Oblique /HelveticaLatin1-Oblique ISOLatin1Encoding ReEncode +/Helvetica-Bold /HelveticaLatin1-Bold ISOLatin1Encoding ReEncode +/Helvetica-BoldOblique /HelveticaLatin1-BoldOblique ISOLatin1Encoding ReEncode + +% scale and set font; define fontsize, fontheight +/setfontandsize { % font size | - + dup 0 le { pop 100 } if % fontsize <= 0 not allowed ! + /fontnonnil true def + pt fm dup /fontsize x def + x findfont + x scalefont + setfont + gsave % determine fontheight - from the cookbook : + np 0 0 mv (1) true charpath flattenpath + pathbbox % low_left_x, low_left_y, up_right_x, up_right_y + x pop x pop x pop + /fontheight x def + grestore +} def + +% standard settings for labelling axes +/setnum { /HelveticaLatin1 24 setfontandsize } bind def +/setlab { /HelveticaLatin1 24 setfontandsize } bind def + +% user commands (free choice of fontsize, but fixed font family) +/setown { /HelveticaLatin1 x setfontandsize } bind def +/setbol { /HelveticaLatin1-Bold x setfontandsize } bind def +/setboq { /HelveticaLatin1-BoldOblique x setfontandsize } bind def +/setobl { /HelveticaLatin1-Oblique x setfontandsize } bind def + + +%% Constants: + +/pt { .018567 mul} bind def +/cm {28.346456 mul} bind def + +/twopi { 6.2831853072 } def + + +%% Math operators: + +/rnd { rand cvr 1 30 bitshift div 2 div 0 max 1 min } def % -> between 0 and 1 /min { 2 copy gt { exch } if pop } def /max { 2 copy lt { exch } if pop } def -%% math: -/eexp { 2.71828 exch exp } def /tan { dup sin x cos div } def /cot { dup cos x sin div } def /pol2xy{ 2 copy cos mul 3 1 roll sin mul } def % r phi | x y + +/eexp { 2.71828 exch exp } def % "exp" is x^y, eexp is e^x /tanh { 2.71828 exch 2 copy exp 3 1 roll neg exp 2 copy sub 3 1 roll add div } def -/rnd { rand cvr 1 30 bitshift div 2 div 0 max 1 min } def % zwischen 0 und 1 -/twopi { 6.2831853072 } def -%% modi : -/Basta { - showpage - end % pop dictionary from stack - } def +%% Page layout and global figure size: + +% shift origin - these are in cm +/cmtranslate { % x y cmtranslate | - + cm x cm x translate } bind def +/EdgeDIN{ 20.3 28.3 cmtranslate } bind def +/EdgeLeftDIN{ .6 28.3 cmtranslate } bind def % longstanding standard in g3.ps +/EdgeAMI{ 18 26 cmtranslate } bind def % ? - ask U.S. colleagues to check ... -/next{ pop } def /nextPoints{ next } def /nextCurve{ next } def +% symbol (and label?) size as sublinear function of figure size +/autolabel { % size(cm) | symbolsize(rel) + dup 7 div 2 add 4 mul % the simplest sublinear increase + exch div % anticipate overall rescaling +} def -%% constants : +% set absolute global scale and relative symbol size +/defsiz { % size(cm) symbolsize(rel) | - + /ftot exch def + cm 10 div dup scale % within 'size', coordinates run from 0 to 10 +} def -/pt { .018567 mul} bind def -/cm {28.346456 mul} bind def + +%% Frame size and shape, frame coordinates: + +% aspect ratios /gyld {0.447214 mul} bind def /Gyld {0.447214 div} bind def % sqrt(5) /guld {0.547723 mul} bind def /Guld {0.547723 div} bind def % sqrt(3) /gold {0.618034 mul} bind def /Gold {0.618034 div} bind def % goldener Schnitt @@ -82,132 +141,71 @@ WuGdict11a begin /geld {0.759836 mul} bind def /Geld {0.759836 div} bind def % sqrt(sqrt(3)) /gald {0.817765 mul} bind def /Gald {0.817765 div} bind def % sqrt sqrt sqrt 5 -%% operations in cm: - -/cmtranslate { % x y cmtranslate - - cm x cm x translate } bind def -/EdgeDIN{ 20.3 28.3 cmtranslate } bind def -/EdgeLeftDIN{ .6 28.3 cmtranslate } bind def -/EdgeAMI{ 18 26 cmtranslate } bind def % ???? - -%% set total and relativ window : - -/defred { % xrel yrel frel defred - ; define xlen,ylen, and the metric xm,ym,fm +% define frame coordinates +/defred { % x_reduction y_reduction label_reduction | - /fmm exch ftot mul def /ymm exch def - /xmm exch def - } def -/defsiz { % size(cm) labelsize(rel) - ; PS-units shall equal xm/ym-units - /ftot exch def - cm 10 div dup scale - } def -/autolabel { % size(cm) | labelsize(rel) - dup 7 div 2 add 4 mul % the simplest sublinear increase - exch div % anticipate overall rescaling - } def - -%% graphic units (running from 0 to 10) : + /xmm exch def +} def +% frame coordinate operators /xm {xmm mul} def /ym {ymm mul} def /fm {fmm mul} def /xym {ym x xm x} def -/offset { xym translate } def -/poloffset { pol2xy offset } def % r phi | -/currentxy { currentpoint ymm div x xmm div x } def - +% only for use in Axx ? (OBSOLESCENT) /mmscale { xmm ymm scale } def /mmunscale { 1 xmm div 1 ymm div scale } def -%% prepare font commands : - -/setfontandsize { % font size setfontandsize - ; - % scale and set font; define fontsize, fontheight - dup 0 le { pop 100 } if % fontsize <= 0 not allowed ! - /fontnonnil true def - pt fm dup /fontsize x def - x findfont - x scalefont - setfont - gsave % determine fontheight - from the cookbook : - np 0 0 mv (1) true charpath flattenpath - pathbbox % low_left_x, low_left_y, up_right_x, up_right_y - x pop x pop x pop - /fontheight x def - grestore - } def - -/SetNum { /HelveticaLatin1 24 setfontandsize } bind def -/setlab { /HelveticaLatin1 24 setfontandsize } bind def -/setown { /HelveticaLatin1 x setfontandsize } bind def -/setbol { /HelveticaLatin1-Bold x setfontandsize } bind def -/setboq { /HelveticaLatin1-BoldOblique x setfontandsize } bind def -/setobl { /HelveticaLatin1-Oblique x setfontandsize } bind def - -%% language selection (27jul97) : - -/language { - /langMax exch def - /langChc exch def -} def - -1 1 language % default - -/langSel { % T_1 .. T_M langSel T_C mit M=langMax, C=langC - langMax dup langChc sub 1 add roll - langMax 1 sub { pop } repeat -} def - -%% prepare drawing commands : +% graphic commands +/offset { xym translate } def +/currentxy { currentpoint ymm div x xmm div x } def +% line width according to relative symbol size /setline { pt fm setlinewidth [] 0 setdash } bind def -%% coordinate system : -%: world coordinates: +%% World (= user application) coordinates: + +% user must declare x and y range /xSetCoord { % log min max | - - /wxmax exch def - /wxmin exch def - /wxlog exch 0 eq not def + /wxmax exch def + /wxmin exch def + /wxlog exch 0 eq not def + % prepare conversion world coord -> frame coord + /wxdel wxmax wxmin wxlog { div log } { sub } ifelse def + /wxd { % dx(world) | dx(frame) + wxlog { log } if wxdel div 10 mul + } bind def + /wx { % x(world) | x(frame) + wxmin wxlog { div } { sub } ifelse + wxd + } bind def } def /ySetCoord { % log min max | - - /wymax exch def - /wymin exch def - /wylog exch 0 eq not def -} def -/wx { - wxlog { - wxmin div log wxmax wxmin div log div 10 mul - } { - wxmin sub wxmax wxmin sub div 10 mul - } ifelse -} def -/wxd { % step - wxlog { - log wxmax wxmin div log div 10 mul - } { - wxmax wxmin sub div 10 mul - } ifelse -} def -/wy { - wylog { - wymin div log wymax wymin div log div 10 mul - } { - wymin sub wymax wymin sub div 10 mul - } ifelse -} def -/wyd { % step - wylog { - log wymax wymin div log div 10 mul - } { - wymax wymin sub div 10 mul - } ifelse + /wymax exch def + /wymin exch def + /wylog exch 0 eq not def + /wydel wymay wymin wylog { div log } { sub } ifelse def + /wyd { % dy(world) | dy(frame) + wylog { log } if wydel div 10 mul + } bind def + /wy { % y(world) | y(frame) + wymin wylog { div } { sub } ifelse + wyd + } bind def } def -/wxy { + +% pair conversion +/wxy { % x,y(world) -> x,y(frame) wy exch wx exch } def + +%%% REVISED UNTIL HERE + + %: new plot : /Resets{ /yNumLengthL 0 def /yNumLengthH 0 def @@ -363,16 +361,16 @@ WuGdict11a begin xTacLen yTacLen rl st } TacExe } def /Num { % General but useless. Adjust for your application. - SetNum + setnum fontheight ymm div yDisRel mul tAng sin mul /yDist x def { dup textW xDisRel mul tAng cos mul /xDist x def xPos aPos xAng mul add xDist sub yPos aPos yAng mul add yDist sub 3 2 roll textCM } TacExe } def -/SetNumDisRel { % xDisRel yDisRel SetNumDisRel - : adjust just a little bit +/setnumDisRel { % xDisRel yDisRel setnumDisRel - : adjust just a little bit /yDisRel x def /xDisRel x def } def -1.2 1.2 SetNumDisRel % default setting +1.2 1.2 setnumDisRel % default setting %: Tacks and Numbers: explicit routines for rectangular case : /xTacL { % : tack on low x axis @@ -408,45 +406,45 @@ WuGdict11a begin { pop aPos ym np xPos xm x mv 10 0 xym rl st } TacExe } def /xNumL { % : numbers on low x axis - SetNum + setnum { fontheight ymm div % conversion -> user_scale dup /xNumHeightL x def -.6 mul yPos add aPos x 3 2 roll textCT } TacExe } def /xNumH { % : numbers on high x axis - SetNum + setnum { fontheight ymm div % conversion -> user_scale dup /xNumHeightH x def .6 mul yPos add aPos x 3 2 roll textCB } TacExe } def /yNumL { % : numbers on low y axis - SetNum + setnum { fontsize -.3 mul xmm div xPos add aPos 3 2 roll textRM xwidth dup yNumLengthL gt {/yNumLengthL x def} {pop} ifelse } TacExe } def /yNumLD { % : calculate only yNumLength (used for adjustement) - SetNum + setnum { textW dup yNumLengthL gt {/yNumLengthL x def} {pop} ifelse } TacExe } def /yDumL { % {(..)} yDumL : compare yNumLength with one arg (used for adjustement) - SetNum + setnum textW dup yNumLengthL gt {/yNumLengthL x def} {pop} ifelse } def /yNumH { % : numbers on high y axis - SetNum + setnum { fontsize .3 mul xmm div xPos add aPos 3 2 roll textLM xwidth dup yNumLengthH gt {/yNumLengthH x def} {pop} ifelse } TacExe } def /yNumHD { % : calculate only yNumLength (used for adjustement) - SetNum + setnum {textW dup yNumLengthH gt {/yNumLengthH x def} {pop} ifelse } TacExe } def /yDumH { % {(..)} yDumH : compare yNumLength with one arg (used for adjustement) - SetNum + setnum textW dup yNumLengthH gt {/yNumLengthH x def} {pop} ifelse } def /xTucL { % len | - : tack on low x axis @@ -502,7 +500,23 @@ WuGdict11a begin grestore } def -%% string treatment : + +%% Language selection: + +/language { + /langMax exch def + /langChc exch def +} def + +1 1 language % default + +/langSel { % T_1 .. T_M langSel T_C mit M=langMax, C=langC + langMax dup langChc sub 1 add roll + langMax 1 sub { pop } repeat +} def + + +%% String treatment: /showif { % string showif - ; increment xwidth or plot string prepare @@ -1434,6 +1448,6 @@ WuGdict11a begin /Celsius { showif (\26x)g(C) showif } bind def -end % pop WuGdict +end % WuGdict... % This is "ewu", the very end of the wups* setup file.