edgecolor='None' & sans-serif math font

I think it has not been resolved. I am not so familiar with the mpl's color
handling code, and I need to turn to "official business" for the rest of the
day. John or Eric, do you have time to look into this? The string 'None' is
supposedly a valid argument, but:

In [1]: plot([1,2])
Out[1]: [<matplotlib.lines.Line2D instance at 0x2b18a14228c0>]

In [2]: savefig('dsd.png', facecolor='None', edgecolor='None')

···

On Friday 09 November 2007 09:24:25 am Peter-Jan Randewijk wrote:

Hi Darren, John, Eric,

Has the issue regarding, edgecolor='None', been resolved or is this
still work in progress.

I am busy with a presentation using LaTeX's Beamer class with a
"corporate gradiented grayish background".

With matplotlib and facecolor=None it almost looks nice, except for the
white edgecolor sticking out on the left of the graph, see attached PDF.

As edgecolor=None isn't working, is there another way of getting rid of
this white edge....?

---------------------------------------------------------------------------
ValueError Traceback (most recent call last)

/home/darren/<ipython console> in <module>()

/usr/lib64/python2.5/site-packages/matplotlib/pyplot.py in savefig(*args,
**kwargs)
    267 def savefig(*args, **kwargs):
    268 fig = gcf()
--> 269 return fig.savefig(*args, **kwargs)
    270 if Figure.savefig.__doc__ is not None:
    271 savefig.__doc__ = dedent(Figure.savefig.__doc__)

/usr/lib64/python2.5/site-packages/matplotlib/figure.py in savefig(self,
*args, **kwargs)
    768 kwargs[key] = rcParams['savefig.%s'%key]
    769
--> 770 self.canvas.print_figure(*args, **kwargs)
    771
    772 def colorbar(self, mappable, cax=None, ax=None, **kw):

/usr/lib64/python2.5/site-packages/matplotlib/backend_bases.py in
print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format,
**kwargs)
   1194 edgecolor=edgecolor,
   1195 orientation=orientation,
-> 1196 **kwargs)
   1197 finally:
   1198 self.figure.dpi.set(origDPI)

/usr/lib64/python2.5/site-packages/matplotlib/backends/backend_gtkagg.py in
print_png(self, filename, *args, **kwargs)
    101 # Do this so we can save the resolution of figure in the PNG
file
    102 agg = self.switch_backends(FigureCanvasAgg)
--> 103 return agg.print_png(filename, *args, **kwargs)
    104
    105 """\

/usr/lib64/python2.5/site-packages/matplotlib/backends/backend_agg.py in
print_png(self, filename, *args, **kwargs)
    415
    416 def print_png(self, filename, *args, **kwargs):
--> 417 self.draw()
    418 self.get_renderer()._renderer.write_png(str(filename),
self.figure.dpi.get())
    419

/usr/lib64/python2.5/site-packages/matplotlib/backends/backend_agg.py in
draw(self)
    377
    378 self.renderer = self.get_renderer()
--> 379 self.figure.draw(self.renderer)
    380
    381 def get_renderer(self):

/usr/lib64/python2.5/site-packages/matplotlib/figure.py in draw(self,
renderer)
    586 self.transFigure.freeze() # eval the lazy objects
    587
--> 588 if self.frameon: self.figurePatch.draw(renderer)
    589
    590 for p in self.patches: p.draw(renderer)

/usr/lib64/python2.5/site-packages/matplotlib/patches.py in draw(self,
renderer)
    199 #renderer.open_group('patch')
    200 gc = renderer.new_gc()
--> 201 gc.set_foreground(self._edgecolor)
    202 gc.set_linewidth(self._linewidth)
    203 gc.set_alpha(self._alpha)

/usr/lib64/python2.5/site-packages/matplotlib/backend_bases.py in
set_foreground(self, fg, isRGB)
    617 self._rgb = fg
    618 else:
--> 619 self._rgb = colors.colorConverter.to_rgb(fg)
    620
    621 def set_graylevel(self, frac):

/usr/lib64/python2.5/site-packages/matplotlib/colors.py in to_rgb(self, arg)
    277
    278 except (KeyError, ValueError, TypeError), exc:
--> 279 raise ValueError('to_rgb: Invalid rgb arg "%s"\n%s' %
(str(arg), exc))
    280 # Error messages could be improved by handling TypeError
    281 # separately; but this should be rare and not too hard

ValueError: to_rgb: Invalid rgb arg "None"
invalid literal for float(): None

I committed changes to svn to add support for face and edgecolor =
'None' for Patch and derived. This still doesn't solve the problem
comprehensively across all artists, which would probably require the
backends to support a None value for the foreground color, but this
would take a fair amount of work (eg logs of get_rgb calls in
backend_ps would have to be fixed) so for now I put on a bandaid and
added support for patches, which allows you do pass edgecolor='None'
to savefig.

I did this by setting the gc linewidth to zero if edgecolor='None',
which should be supported by all backends (in mpl linewidth=0 means no
line, different from postscript where it means the thinnest possible
line) but if you find that it isn't, let us know.

JDH

···

On Nov 9, 2007 8:45 AM, Darren Dale <darren.dale@...163...> wrote:

I think it has not been resolved. I am not so familiar with the mpl's color
handling code, and I need to turn to "official business" for the rest of the
day. John or Eric, do you have time to look into this? The string 'None' is
supposedly a valid argument, but: