annotate weblogolib/template.eps @ 8:5149eb3a89c2

Uploaded
author davidmurphy
date Fri, 20 Jan 2012 09:03:40 -0500
parents c55bdc2fb9fa
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
1 %!PS-Adobe-3.0 EPSF-3.0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
2 %%Title: Sequence Logo: ${logo_title}
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
3 %%Creator: ${creator_text}
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
4 %%CreationDate: ${creation_date}
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
5 %%BoundingBox: 0 0 ${logo_width} ${logo_height}
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
6 %%Pages: 0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
7 %%DocumentFonts:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
8 %%EndComments
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
9
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
10
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
11 % ---- VARIABLES ----
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
12
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
13 /True true def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
14 /False false def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
15
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
16 /debug ${debug} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
17
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
18 /logo_height ${logo_height} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
19 /logo_width ${logo_width} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
20 /logo_title (${logo_title}) def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
21 /show_title ${show_title} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
22
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
23 /logo_margin ${logo_margin} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
24 /xaxis_label_height ${xaxis_label_height} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
25 /title_height ${title_height} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
26 /stroke_width ${stroke_width} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
27 /tic_length ${tic_length} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
28
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
29 /lines_per_logo ${lines_per_logo} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
30 /line_width ${line_width} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
31 /line_height ${line_height} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
32 /line_margin_left ${line_margin_left} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
33 /line_margin_right ${line_margin_right} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
34 /line_margin_bottom ${line_margin_bottom} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
35 /line_margin_top ${line_margin_top} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
36
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
37 /stack_width ${stack_width} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
38 /stack_height ${stack_height} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
39 /stacks_per_line ${stacks_per_line} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
40 /stack_margin ${stack_margin} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
41
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
42 /show_yaxis ${show_yaxis} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
43 /show_yaxis_label ${show_yaxis_label} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
44 /yaxis_label (${yaxis_label}) def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
45 /yaxis_scale ${yaxis_scale} def % height in units
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
46 /yaxis_tic_interval ${yaxis_tic_interval} def % in units
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
47 /yaxis_minor_tic_interval ${yaxis_minor_tic_interval} def % in units
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
48
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
49 /show_xaxis_label ${show_xaxis_label} def % True or False
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
50 /show_xaxis ${show_xaxis} def % True or False
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
51 /xaxis_label (${xaxis_label}) def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
52 /xaxis_tic_interval ${xaxis_tic_interval} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
53 /rotate_numbers ${rotate_numbers} def % True or False
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
54 /number_interval ${number_interval} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
55 /show_ends ${show_ends} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
56 /end_type (${end_type}) def % d: DNA, p: PROTEIN, -: none
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
57
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
58 /show_fineprint ${show_fineprint} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
59 /fineprint (${fineprint}) def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
60 /logo_label (${logo_label}) def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
61
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
62 /show_boxes ${show_boxes} def % True or False
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
63 /shrink ${shrink} def % True or False
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
64 /shrink_fraction ${shrink_fraction} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
65
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
66 /show_errorbars ${show_errorbars} def % True or False
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
67 /errorbar_fraction ${errorbar_fraction} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
68 /errorbar_width_fraction ${errorbar_width_fraction} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
69 /errorbar_gray ${errorbar_gray} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
70
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
71 /fontsize ${fontsize} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
72 /small_fontsize ${small_fontsize} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
73 /title_fontsize ${title_fontsize} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
74 /number_fontsize ${number_fontsize} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
75
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
76
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
77 /UseCIEColor true def % Fix for issue 4
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
78 /default_color ${default_color} def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
79 /color_dict <<
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
80 ${color_dict}
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
81 >> def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
82
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
83
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
84
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
85 % ---- DERIVED PARAMETERS ----
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
86
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
87 /char_width stack_width 2 stack_margin mul sub def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
88 /char_width2 char_width 2 div def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
89 /char_width4 char_width 4 div def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
90
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
91 % movements to place 5'/N and 3'/C symbols
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
92 /leftEndDeltaX fontsize neg def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
93 /leftEndDeltaY fontsize 1.25 mul neg def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
94 /rightEndDeltaX fontsize 0.25 mul def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
95 /rightEndDeltaY leftEndDeltaY def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
96
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
97
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
98 % ---- PROCEDURES ----
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
99
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
100
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
101 /SetTitleFont {/${title_font} findfont title_fontsize scalefont setfont} bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
102 /SetLogoFont {/${logo_font} findfont char_width scalefont setfont} bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
103 /SetStringFont{/${text_font} findfont fontsize scalefont setfont} bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
104 /SetPrimeFont {/Symbol findfont fontsize scalefont setfont} bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
105 /SetSmallFont {/${text_font} findfont small_fontsize scalefont setfont} bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
106 /SetNumberFont {/${text_font} findfont number_fontsize scalefont setfont} bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
107
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
108 /DrawBox { % width height
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
109 /hh exch def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
110 /ww exch def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
111 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
112 0.2 setlinewidth
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
113 %0.5 setgray
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
114
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
115 %0 0 moveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
116 hh 0 rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
117 0 ww rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
118 hh neg 0 rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
119 0 ww neg rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
120 stroke
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
121 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
122 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
123
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
124
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
125 /StartLogo {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
126 %save
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
127 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
128
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
129
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
130 debug {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
131 logo_margin logo_margin moveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
132 logo_height logo_margin 2 mul sub
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
133 logo_width logo_margin 2 mul sub
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
134 DrawBox } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
135
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
136 show_title { DrawTitle } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
137 show_xaxis_label { DrawXaxisLable } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
138 show_fineprint { DrawFineprint } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
139 DrawLogoLabel
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
140
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
141
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
142 MoveToFirstLine
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
143 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
144
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
145
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
146 /DrawLogoLabel {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
147 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
148 SetTitleFont
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
149
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
150 logo_margin
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
151 logo_height title_fontsize sub logo_margin sub
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
152 moveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
153
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
154 debug { title_fontsize logo_label stringwidth pop DrawBox } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
155 0 title_fontsize 4 div rmoveto % Move up to baseline (approximatly)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
156 logo_label show
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
157
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
158 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
159 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
160
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
161 /DrawTitle {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
162 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
163 SetTitleFont
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
164
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
165 logo_width 2 div logo_title stringwidth pop 2 div sub
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
166 logo_height title_fontsize sub logo_margin sub
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
167 moveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
168
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
169 debug { title_fontsize logo_title stringwidth pop DrawBox } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
170
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
171 0 title_fontsize 4 div rmoveto % Move up to baseline (approximatly)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
172 logo_title show
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
173
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
174 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
175 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
176
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
177 /DrawXaxisLable {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
178 % Print X-axis label, bottom center
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
179 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
180 SetStringFont
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
181
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
182 logo_width 2 div xaxis_label stringwidth pop 2 div sub
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
183 xaxis_label_height logo_margin add fontsize sub
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
184 moveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
185 %fontsize 3 div
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
186
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
187 debug { fontsize xaxis_label stringwidth pop DrawBox } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
188
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
189 xaxis_label show
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
190
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
191 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
192 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
193
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
194
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
195 /DrawFineprint {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
196 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
197
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
198 SetSmallFont
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
199
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
200 logo_width fineprint stringwidth pop sub
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
201 logo_margin sub line_margin_right sub
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
202 logo_margin
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
203 moveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
204
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
205 debug { small_fontsize fineprint stringwidth pop DrawBox } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
206
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
207 fineprint show
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
208 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
209 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
210
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
211 /MoveToFirstLine {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
212 logo_margin
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
213 logo_height logo_margin sub title_height sub line_height sub
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
214 moveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
215 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
216
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
217 /EndLogo {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
218 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
219 %showpage
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
220 %restore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
221 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
222
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
223
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
224 /StartLine{
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
225 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
226
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
227 % Draw outer box
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
228 debug { line_height line_width DrawBox } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
229
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
230 % Move to lower left corner of content area
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
231 line_margin_left line_margin_bottom rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
232
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
233 % Draw inner content box
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
234 debug {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
235 line_height line_margin_bottom sub line_margin_top sub
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
236 line_width line_margin_left sub line_margin_right sub
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
237 DrawBox
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
238 } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
239
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
240 show_yaxis { DrawYaxis } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
241 show_xaxis { DrawLeftEnd } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
242
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
243 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
244
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
245 /EndLine{
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
246 show_xaxis { DrawRightEnd } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
247 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
248 0 line_height neg rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
249 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
250
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
251
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
252 /DrawYaxis {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
253 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
254 stack_margin neg 0 translate
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
255 DrawYaxisBar
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
256 DrawYaxisLabel
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
257 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
258 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
259
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
260
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
261 /DrawYaxisBar {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
262 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
263 stack_margin neg 0 rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
264
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
265 SetNumberFont
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
266 stroke_width setlinewidth
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
267
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
268 /str 10 string def % string to hold number
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
269 /smallgap stack_margin def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
270
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
271 % Draw first tic and bar
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
272 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
273 tic_length neg 0 rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
274 tic_length 0 rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
275 0 stack_height rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
276 stroke
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
277 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
278
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
279 % Draw the tics
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
280 % initial increment limit proc for
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
281 0 yaxis_tic_interval yaxis_scale abs
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
282 {/loopnumber exch def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
283
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
284 % convert the number coming from the loop to a string
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
285 % and find its width
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
286 loopnumber 10 str cvrs
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
287 /stringnumber exch def % string representing the number
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
288
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
289 stringnumber stringwidth pop
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
290 /numberwidth exch def % width of number to show
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
291
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
292 /halfnumberheight
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
293 stringnumber CharBoxHeight 2 div
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
294 def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
295
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
296 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
297 numberwidth % move back width of number
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
298 neg loopnumber stack_height yaxis_scale div mul % shift on y axis
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
299 halfnumberheight sub % down half the digit
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
300 rmoveto % move back the width of the string
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
301
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
302 tic_length neg smallgap sub % Move back a bit more
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
303 0 rmoveto % move back the width of the tic
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
304
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
305 stringnumber show
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
306 smallgap 0 rmoveto % Make a small gap
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
307
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
308 % now show the tic mark
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
309 0 halfnumberheight rmoveto % shift up again
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
310 tic_length 0 rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
311 stroke
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
312 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
313 } for
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
314
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
315 % Draw the minor tics
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
316 % initial increment limit proc for
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
317 0 yaxis_minor_tic_interval yaxis_scale abs
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
318 {/loopnumber2 exch def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
319 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
320 0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
321 loopnumber2 stack_height yaxis_scale div mul
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
322 rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
323
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
324 tic_length 2 div neg 0 rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
325 stroke
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
326 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
327 } for
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
328
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
329 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
330 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
331
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
332 /DrawYaxisLabel {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
333 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
334 SetStringFont
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
335
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
336 % How far we move left depends on the size of
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
337 % the tic labels.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
338 /str 10 string def % string to hold number
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
339 yaxis_scale yaxis_tic_interval div cvi yaxis_tic_interval mul
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
340 str cvs stringwidth pop
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
341 tic_length 1.25 mul add neg
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
342
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
343 stack_height
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
344 yaxis_label stringwidth pop
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
345 sub 2 div
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
346
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
347 rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
348 90 rotate
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
349
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
350 yaxis_label show
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
351 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
352 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
353
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
354
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
355 %Take a single character and return the bounding box
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
356 /CharBox { % <char> CharBox <lx> <ly> <ux> <uy>
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
357 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
358 newpath
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
359 0 0 moveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
360 % take the character off the stack and use it here:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
361 true charpath
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
362 flattenpath
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
363 pathbbox % compute bounding box of 1 pt. char => lx ly ux uy
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
364 % the path is here, but toss it away ...
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
365 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
366 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
367
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
368
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
369 % The height of a characters bounding box
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
370 /CharBoxHeight { % <char> CharBoxHeight <num>
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
371 CharBox
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
372 exch pop sub neg exch pop
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
373 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
374
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
375
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
376 % The width of a characters bounding box
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
377 /CharBoxWidth { % <char> CharBoxHeight <num>
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
378 CharBox
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
379 pop exch pop sub neg
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
380 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
381
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
382
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
383 /DrawLeftEnd {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
384 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
385 SetStringFont
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
386 leftEndDeltaX leftEndDeltaY rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
387
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
388 show_ends {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
389 debug { leftEndDeltaY neg leftEndDeltaX neg DrawBox } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
390 end_type (d) eq {(5) show DrawPrime} if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
391 end_type (p) eq {(N) show} if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
392 } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
393 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
394 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
395
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
396 /DrawRightEnd {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
397 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
398 SetStringFont
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
399 rightEndDeltaX rightEndDeltaY rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
400
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
401 show_ends {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
402 debug { rightEndDeltaY neg leftEndDeltaX neg DrawBox } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
403 end_type (d) eq {(3) show DrawPrime} if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
404 end_type (p) eq {(C) show} if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
405 } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
406 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
407 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
408
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
409 /DrawPrime {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
410 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
411 SetPrimeFont
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
412 (\242) show
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
413 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
414 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
415
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
416
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
417 /StartStack { % <stackNumber> startstack
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
418 show_xaxis {DrawNumber}{pop} ifelse
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
419 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
420 debug { stack_height stack_width DrawBox } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
421
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
422 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
423
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
424 /EndStack {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
425 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
426 stack_width 0 rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
427 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
428
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
429
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
430 /DrawNumber { % number MakeNumber
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
431 /n exch def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
432
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
433
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
434 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
435 %0 stack_margin neg rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
436 stroke_width setlinewidth
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
437 stack_width 0 rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
438 stack_width 2 div neg 0 rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
439
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
440 n () eq
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
441 { 0 tic_length 4 div neg rlineto }
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
442 { 0 tic_length 2 div neg rlineto }
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
443 ifelse
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
444
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
445 stroke
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
446 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
447
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
448
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
449
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
450 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
451 n
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
452 SetNumberFont
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
453 stack_width 2 div tic_length 2 div neg rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
454
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
455 rotate_numbers {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
456 90 rotate
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
457 dup stringwidth pop neg % find the length of the number
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
458 stack_margin sub % Move down a bit
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
459 (0) CharBoxHeight 2 div neg % left half height of numbers
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
460 rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
461 show
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
462 } {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
463 dup stringwidth pop neg 2 div number_fontsize neg rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
464 show
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
465 } ifelse
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
466
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
467
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
468
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
469 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
470 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
471
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
472
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
473
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
474 % Draw a character whose height is proportional to symbol bits
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
475 /ShowSymbol{ % interval character ShowSymbol
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
476 /char exch def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
477 /interval exch def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
478 /fraction_width exch def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
479
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
480 /char_height
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
481 interval yaxis_scale div stack_height mul
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
482 stack_margin sub
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
483 dup
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
484 % if char_height is negative or very small replace with zero
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
485 % BUG FIX: This used to be '0.0 gt' but it seems that DrawHeight
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
486 % has a finite, non-zero minimum, which results in a rangecheck error
8
5149eb3a89c2 Uploaded
davidmurphy
parents: 0
diff changeset
487 0.01 gt {}{pop 0.0} ifelse
0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
488 def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
489
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
490 char_height 0.0 gt {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
491 show_boxes {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
492 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
493 /ww char_height stack_margin add def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
494 /hh stack_width def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
495 stroke_width setlinewidth
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
496 hh 0 rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
497 0 ww rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
498 hh neg 0 rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
499 0 ww neg rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
500 stroke
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
501 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
502 } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
503
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
504 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
505 stack_margin stack_margin rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
506 debug { char_height char_width DrawBox } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
507 1 fraction_width sub char_width mul 2 div 0 rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
508 fraction_width char_width mul char_height char DrawChar
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
509 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
510
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
511 } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
512 0 interval yaxis_scale div stack_height mul rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
513 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
514
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
515
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
516 /DrawChar { % <width> <height> <char> ShowChar
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
517 /tc exch def % The character
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
518 /ysize exch def % the y size of the character
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
519 /xsize exch def % the x size of the character
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
520 /xmulfactor 1 def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
521 /ymulfactor 1 def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
522
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
523 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
524 SetLogoFont
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
525 tc SetColor
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
526
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
527 % IReplacementHack
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
528 % Deal with the lack of bars on the letter 'I' in Arial and Helvetica
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
529 % by replacing with 'I' from Courier.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
530 tc (I) eq {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
531 /Courier findfont char_width scalefont setfont
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
532 } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
533
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
534
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
535 shrink {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
536 xsize 1 shrink_fraction sub 2 div mul
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
537 ysize 1 shrink_fraction sub 2 div mul rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
538 shrink_fraction shrink_fraction scale
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
539 } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
540
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
541 % Calculate the font scaling factors
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
542 % Loop twice to catch small correction due to first scaling
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
543 2 {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
544 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
545 xmulfactor ymulfactor scale
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
546
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
547 ysize % desired size of character in points
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
548 tc CharBoxHeight
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
549 dup 0.0 ne {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
550 div % factor by which to scale up the character
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
551 /ymulfactor exch def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
552 } {pop pop} ifelse
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
553
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
554 xsize % desired size of character in points
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
555 tc CharBoxWidth
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
556 dup 0.0 ne {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
557 div % factor by which to scale up the character
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
558 /xmulfactor exch def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
559 } {pop pop} ifelse
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
560 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
561 } repeat
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
562
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
563
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
564
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
565 % Draw the character
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
566 xmulfactor ymulfactor scale
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
567 % Move lower left corner of character to start point
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
568 tc CharBox pop pop % llx lly : Lower left corner
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
569 exch neg exch neg
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
570 rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
571
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
572 tc show
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
573
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
574 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
575 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
576
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
577 /SetColor{ % <char> SetColor
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
578 dup color_dict exch known {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
579 color_dict exch get aload pop setrgbcolor
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
580 } {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
581 pop
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
582 default_color aload pop setrgbcolor
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
583 } ifelse
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
584 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
585
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
586
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
587 /DrawErrorbar{ % interval_down interval_up DrawErrorbar
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
588
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
589 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
590 /points_per_unit stack_height yaxis_scale div def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
591 /height_up exch points_per_unit mul def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
592 /height_down exch points_per_unit mul def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
593
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
594 show_errorbars {
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
595
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
596 stroke_width setlinewidth
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
597 errorbar_gray setgray
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
598 stack_width 2 div 0 rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
599
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
600 /errorbar_width char_width errorbar_width_fraction mul def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
601 /errorbar_width2 errorbar_width 2 div def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
602
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
603 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
604 0 height_down neg rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
605 errorbar_width2 neg 0 rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
606 errorbar_width 0 rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
607 errorbar_width2 neg 0 rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
608 0 height_down errorbar_fraction mul rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
609 stroke
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
610 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
611
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
612 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
613 0 height_up rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
614 errorbar_width2 neg 0 rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
615 errorbar_width 0 rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
616 errorbar_width2 neg 0 rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
617 0 height_up neg errorbar_fraction mul rlineto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
618 stroke
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
619 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
620 } if
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
621
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
622 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
623
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
624 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
625
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
626 /DrawErrorbarFirst{ % interval_down interval_up center DrawErrorbarFirst
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
627 gsave
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
628 /points_per_unit stack_height yaxis_scale div def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
629 /center exch points_per_unit mul def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
630
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
631 0 center rmoveto
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
632 DrawErrorbar
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
633 grestore
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
634 } bind def
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
635
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
636 %%EndProlog
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
637
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
638 %%Page: 1 1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
639
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
640 % Example Data
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
641 %StartLogo
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
642 % StartLine
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
643 % (1) StartStack
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
644 % 1.2 (C) ShowSymbol
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
645 % 2.2 (I) ShowSymbol
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
646 % 0.5 0.5 DrawErrorbar
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
647 % EndStack
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
648 % (2) StartStack
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
649 % 0.5 (I) ShowSymbol
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
650 % 0.9 (L) ShowSymbol
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
651 % 1.0 (G) ShowSymbol
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
652 %
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
653 % 0.5 0.5 DrawErrorbar
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
654 % EndStack
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
655 % (234) StartStack
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
656 % EndStack
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
657 % (235) StartStack
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
658 % EndStack
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
659 % EndLine
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
660 %EndLogo
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
661
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
662 StartLogo
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
663
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
664 ${logo_data}
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
665
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
666 EndLogo
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
667
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
668
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
669 %%EOF