Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

saving to *.eps broken on master #1693

Closed
tacaswell opened this Issue · 1 comment

2 participants

@tacaswell
Owner
fig = figure()
ax = fig.gca()
th = np.linspace(0,2 * np.pi, 3000)
th_al = np.linspace(0,2 * np.pi, 20)

ax.plot(th, sin(20 * th), label='signal')
ax.plot(th_al, sin(20 * th_al), label='aliased', marker='o')
ax.legend()


fig.savefig('test.eps')

does not work on master. Going through git bisect, it looks like I broke it at 0c20b5c

It looks like switching from rgb -> rgba in the marker code broke the ps backend which assumes that it is getting a len 3 object, not a len 4 object. I will be submitting a PR with a fix soon.

Stack trace from master:

/home/tcaswell/local_installs/lib/python2.7/site-packages/matplotlib/figure.pyc in savefig(self, *args, **kwargs)
   1361             kwargs.setdefault('edgecolor', rcParams['savefig.edgecolor'])
   1362 
-> 1363         self.canvas.print_figure(*args, **kwargs)
   1364 
   1365         if transparent:

/home/tcaswell/local_installs/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.pyc in print_figure(self, *args, **kwargs)
    159 
    160     def print_figure(self, *args, **kwargs):
--> 161         FigureCanvasAgg.print_figure(self, *args, **kwargs)
    162         self.draw()

/home/tcaswell/local_installs/lib/python2.7/site-packages/matplotlib/backend_bases.pyc in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
   2130                 orientation=orientation,
   2131                 bbox_inches_restore=_bbox_inches_restore,
-> 2132                 **kwargs)
   2133         finally:
   2134             if bbox_inches and restore_bbox:

/home/tcaswell/local_installs/lib/python2.7/site-packages/matplotlib/backend_bases.pyc in print_eps(self, *args, **kwargs)
   1874         from backends.backend_ps import FigureCanvasPS  # lazy import
   1875         ps = self.switch_backends(FigureCanvasPS)
-> 1876         return ps.print_eps(*args, **kwargs)
   1877 
   1878     def print_pdf(self, *args, **kwargs):

/home/tcaswell/local_installs/lib/python2.7/site-packages/matplotlib/backends/backend_ps.pyc in print_eps(self, outfile, *args, **kwargs)
    972 
    973     def print_eps(self, outfile, *args, **kwargs):
--> 974         return self._print_ps(outfile, 'eps', *args, **kwargs)
    975 
    976 

/home/tcaswell/local_installs/lib/python2.7/site-packages/matplotlib/backends/backend_ps.pyc in _print_ps(self, outfile, format, *args, **kwargs)
   1005             self._print_figure(outfile, format, imagedpi, facecolor, edgecolor,
   1006                                orientation, isLandscape, papertype,
-> 1007                                **kwargs)
   1008 
   1009     def _print_figure(self, outfile, format, dpi=72, facecolor='w', edgecolor='w',

/home/tcaswell/local_installs/lib/python2.7/site-packages/matplotlib/backends/backend_ps.pyc in _print_figure(self, outfile, format, dpi, facecolor, edgecolor, orientation, isLandscape, papertype, **kwargs)
   1098             bbox_inches_restore=_bbox_inches_restore)
   1099 
-> 1100         self.figure.draw(renderer)
   1101 
   1102         if dryrun: # return immediately if dryrun (tightbbox=True)

/home/tcaswell/local_installs/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
     52     def draw_wrapper(artist, renderer, *args, **kwargs):
     53         before(artist, renderer)
---> 54         draw(artist, renderer, *args, **kwargs)
     55         after(artist, renderer)
     56 

/home/tcaswell/local_installs/lib/python2.7/site-packages/matplotlib/figure.pyc in draw(self, renderer)
    997         dsu.sort(key=itemgetter(0))
    998         for zorder, a, func, args in dsu:
--> 999             func(*args)
   1000 
   1001         renderer.close_group('figure')

/home/tcaswell/local_installs/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
     52     def draw_wrapper(artist, renderer, *args, **kwargs):
     53         before(artist, renderer)
---> 54         draw(artist, renderer, *args, **kwargs)
     55         after(artist, renderer)
     56 

/home/tcaswell/local_installs/lib/python2.7/site-packages/matplotlib/axes.pyc in draw(self, renderer, inframe)
   2068 
   2069         for zorder, a in dsu:
-> 2070             a.draw(renderer)
   2071 
   2072         renderer.close_group('axes')

/home/tcaswell/local_installs/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
     52     def draw_wrapper(artist, renderer, *args, **kwargs):
     53         before(artist, renderer)
---> 54         draw(artist, renderer, *args, **kwargs)
     55         after(artist, renderer)
     56 

/home/tcaswell/local_installs/lib/python2.7/site-packages/matplotlib/lines.pyc in draw(self, renderer)
    579                 renderer.draw_markers(
    580                     gc, marker_path, marker_trans, subsampled, affine.frozen(),
--> 581                     rgbaFace)
    582                 alt_marker_path = marker.get_alt_path()
    583                 if alt_marker_path:

/home/tcaswell/local_installs/lib/python2.7/site-packages/matplotlib/backends/backend_ps.pyc in draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace)
    588                 ps_color = '%1.3f setgray' % rgbFace[0]
    589             else:
--> 590                 ps_color = '%1.3f %1.3f %1.3f setrgbcolor' % rgbFace
    591 
    592         # construct the generic marker command:

TypeError: not all arguments converted during string formatting
@tacaswell tacaswell referenced this issue from a commit in tacaswell/matplotlib
@tacaswell tacaswell fixes Issue #1693
Explicitly trim rgbFace to length 3 so that the string formats do
not blow up.
5428a53
@WeatherGod
Collaborator

Fixed by #1694

@WeatherGod WeatherGod closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.