T J wrote:
On Wed, Apr 28, 2010 at 12:22 PM, Eric Firing <efir...@hawaii.edu> wrote:
It's a bug, made more confusing by the trickery that is done when printing a
figure.  DPI, facecolor, and edgecolor that are set for a figure object are
used only for screen display, and are overridden when the figure is saved.
 The overriding values can be supplied to the savefig call or via rcParams.

I think I have fixed the bug in svn, so that "transparent" will work as
advertised.  In addition, I made a change so that even with
transparent=True, if you supply facecolor and/or edgecolor to the savefig
call, those values should be used for the figure patch when the figure is
saved.  This might be useful if you want to keep the line around the figure,
for example.


This still does not work for me.  I dug around a bit and found an
issue.  Figure.savefig() sets the 'edgecolor' and 'facecolor' of the
axis patches but delegates the patches of the figure to the actual
print command.  It does this by setting the edgecolor and facecolor
values in the kwargs dict.  However, self.canvas.print_figure()
expects edgecolor and facecolor as args, not kwargs.  So
print_figure() uses the default value: 'w' instead of 'none'.  This is
a bit inconsistent, it seems, especially b/c the PS backend  (which is
called after print_figure()) expects facecolor and edgecolor as
kwargs.

I don't see this in the version as I changed it in svn r8282. Are you sure you installed and built from svn after I made the change? Using the attached script, I get the two attached (gzipped) eps files. The first with transparent=True, has no fill operations other than for generation of the glyphs; the second differs from the first in having two extra fill operations, one for the axes patch, the other for the figure patch.

When I use your transeps.tex, run latex, and then dvips, the resulting ps file (also gzipped and attached) has the figure with a red background, sitting on a white page. I presume this is what you expect, and so the figure and axes really are transparent.

Eric


I went ahead and changed this, hoping it'd fix the issue, but it does
not.  At least now, I can see that the edgecolor and facecolor are
both set to 'none' all the way until self.figure.draw(renderer) is
called.  So somehow, the draw() command is unaffected by this still.

What next?

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

import matplotlib.pyplot as plt

f = plt.figure()
ax = f.add_subplot(111)
ax.plot([0,10])
f.savefig('transeps.eps', transparent=True)
f.savefig('transeps_opaque.eps')

Attachment: transeps.eps.gz
Description: GNU Zip compressed data

Attachment: transeps_opaque.eps.gz
Description: GNU Zip compressed data

Attachment: transeps.ps.gz
Description: GNU Zip compressed data

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to