Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1696792

Browse files
committed
playing with _draw_markers
svn path=/trunk/matplotlib/; revision=2165
1 parent 064ea12 commit 1696792

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

lib/matplotlib/backends/backend_ps.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -411,19 +411,22 @@ def _draw_markers(self, gc, path, rgbFace, x, y, transform):
411411
"""
412412
if debugPS: self._pswriter.write('% draw_markers \n')
413413

414-
return
414+
## return
415415
if rgbFace:
416416
if rgbFace[0]==rgbFace[0] and rgbFace[0]==rgbFace[2]:
417417
ps_color = '%1.3f setgray' % rgbFace[0]
418418
else:
419419
ps_color = '%1.3f %1.3f %1.3f setrgbcolor' % rgbFace
420-
421-
#if transform.need_nonlinear():
422-
# x,y,mask = transform.nonlinear_only_numerix(x, y, returnMask=1)
423-
#else:
424-
# mask = ones(x.shape)
425-
420+
421+
print x,y
422+
if transform.need_nonlinear():
423+
x,y,mask = transform.nonlinear_only_numerix(x, y, returnMask=1)
424+
print x,y
425+
else:
426+
mask = ones(x.shape)
427+
426428
x, y = transform.numerix_x_y(x, y)
429+
print x, y
427430

428431
# the a,b,c,d,tx,ty affine which transforms x and y
429432
#vec6 = transform.as_vec6_val()
@@ -469,15 +472,16 @@ def _draw_markers(self, gc, path, rgbFace, x, y, transform):
469472
ps_cmd.append('grestore') # undo translate()
470473
ps_cmd = '\n'.join(ps_cmd)
471474

472-
#self._pswriter.write(' '.join(['/marker {', ps_cmd, '} bind def\n']))
475+
self._pswriter.write(' '.join(['/marker {', ps_cmd, '} bind def\n']))
473476
#self._pswriter.write('[%s]' % ';'.join([float(val) for val in vec6]))
474477
# Now evaluate the marker command at each marker location:
475478
start = 0
476479
end = 1000
477480
while start < len(x):
478481

479-
to_draw = izip(x[start:end],y[start:end])
480-
ps = ['%1.3f %1.3f marker' % point for point in to_draw]
482+
to_draw = izip(x[start:end],y[start:end],mask[start:end])
483+
ps = ['%1.3f %1.3f marker' % (xp, yp) for xp, yp, m in to_draw if m]
484+
print ps
481485
self._draw_ps("\n".join(ps), gc, None)
482486
start = end
483487
end += 1000

0 commit comments

Comments
 (0)