@@ -31,11 +31,40 @@ def _fn_name(): return sys._getframe(1).f_code.co_name
31
31
import re
32
32
33
33
backend_version = 'Level II'
34
- defaultPaperSize = 8.5 ,11 # TODO: make this configurable
35
- debugPS = 1
36
-
37
34
35
+ debugPS = 1
38
36
37
+ papersize = {'executive' : (7.5 ,11 ),
38
+ 'letter' : (8.5 ,11 ),
39
+ 'legal' : (8.5 ,14 ),
40
+ 'ledger' : (11 ,17 ),
41
+ 'a0' : (33.11 ,46.81 ),
42
+ 'a1' : (23.39 ,33.11 ),
43
+ 'a2' : (16.54 ,23.39 ),
44
+ 'a3' : (11.69 ,16.54 ),
45
+ 'a4' : (8.27 ,11.69 ),
46
+ 'a5' : (5.83 ,8.27 ),
47
+ 'a6' : (4.13 ,5.83 ),
48
+ 'a7' : (2.91 ,4.13 ),
49
+ 'a8' : (2.07 ,2.91 ),
50
+ 'a9' : (1.457 ,2.05 ),
51
+ 'a10' : (1.02 ,1.457 ),
52
+ 'b0' : (40.55 ,57.32 ),
53
+ 'b1' : (28.66 ,40.55 ),
54
+ 'b2' : (20.27 ,28.66 ),
55
+ 'b3' : (14.33 ,20.27 ),
56
+ 'b4' : (10.11 ,14.33 ),
57
+ 'b5' : (7.16 ,10.11 ),
58
+ 'b6' : (5.04 ,7.16 ),
59
+ 'c0' : (36.10 ,51.06 ),
60
+ 'c1' : (25.51 ,36.10 ),
61
+ 'c2' : (18.03 ,25.51 ),
62
+ 'c3' : (12.75 ,18.03 ),
63
+ 'c4' : (9.01 ,12.75 ),
64
+ 'c5' : (6.38 ,9.01 ),
65
+ 'c6' : (4.49 ,6.38 )}
66
+ defaultPaperType = rcParams ['ps.papersize' ]
67
+ defaultPaperSize = papersize [defaultPaperType ]
39
68
40
69
def _num_to_str (val ):
41
70
if is_string_like (val ): return val
@@ -334,7 +363,6 @@ def _draw_markers(self, gc, path, rgbFace, x, y, transform):
334
363
# construct the generic marker command:
335
364
ps_cmd = ['gsave' ]
336
365
ps_cmd .append ('newpath' )
337
- ## ps_cmd.append('%1.3f %1.3f translate')
338
366
ps_cmd .append ('translate' )
339
367
while 1 :
340
368
code , xp , yp = path .vertex ()
@@ -357,6 +385,7 @@ def _draw_markers(self, gc, path, rgbFace, x, y, transform):
357
385
else :
358
386
pass
359
387
#print code
388
+
360
389
if rgbFace :
361
390
ps_cmd .append ('gsave' )
362
391
ps_cmd .append (ps_color )
@@ -369,21 +398,15 @@ def _draw_markers(self, gc, path, rgbFace, x, y, transform):
369
398
#self._pswriter.write(' '.join(['/marker {', ps_cmd, '} bind def\n']))
370
399
#self._pswriter.write('[%s]' % ';'.join([float(val) for val in vec6]))
371
400
# Now evaluate the marker command at each marker location:
372
- ## points = zip(x,y)
373
401
start = 0
374
402
end = 1000
375
403
while start < len (x ):
376
404
377
405
to_draw = izip (x [start :end ],y [start :end ])
378
- ## ps = [ps_cmd % point for point in to_draw]
379
406
ps = ['%1.3f %1.3f marker' % point for point in to_draw ]
380
407
self ._draw_ps ("\n " .join (ps ), gc , None )
381
408
start = end
382
409
end += 1000
383
-
384
- ## draw_ps = self._draw_ps
385
- ## for xp,yp in izip(x,y):
386
- ## draw_ps(ps_cmd % (xp,yp), gc, None)
387
410
388
411
def draw_path (self ,gc ,rgbFace ,path ,trans ):
389
412
pass
@@ -905,6 +928,7 @@ def print_figure(self, outfile, dpi=72,
905
928
else :
906
929
ostr = "Portrait"
907
930
print >> fh , "%%Orientation: " + ostr
931
+ print >> fh , "%%DocumentPaperSizes: " + defaultPaperType
908
932
print >> fh , "%%%%BoundingBox: %d %d %d %d" % (llx , lly , urx , ury )
909
933
if not isEPSF : print >> fh , "%%Pages: 1"
910
934
print >> fh , "%%EndComments"
0 commit comments