New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix transparent markers in PDF backend. Closes #1410 #1411
Conversation
@mdboom Does this work with alpha transparency? |
alpha works to the extent that it always did -- i.e. not a lot of fine control. This only addresses the case where |
Sweet. This gets my +1 when the Travis tests pass. Also, I'd like to express that I am very impressed with your response on this bug! :) |
@@ -1556,7 +1556,10 @@ def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None) | |||
return | |||
|
|||
self.check_gc(gc, rgbFace) | |||
fillp = gc.fillp() | |||
if rgbFace: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I have not figured out is why it did not work the way it was; it would seem that check_gc already stores rgbFace in gc._fillcolor, and that gc.filp() checks that for None. So it seems odd to need this extra block of code here. It might be worth putting in a comment to explain it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is check_gc
:
def check_gc(self, gc, fillcolor=None):
orig_fill = gc._fillcolor
gc._fillcolor = fillcolor
delta = self.gc.delta(gc)
if delta: self.file.output(*delta)
# Restore gc to avoid unwanted side effects
gc._fillcolor = orig_fill
It looks like the last line restores it. Might that be the cause?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On 2012/10/17 11:29 AM, Damon McDougall wrote:
In lib/matplotlib/backends/backend_pdf.py:
@@ -1556,7 +1556,10 @@ def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None)
returnself.check_gc(gc, rgbFace)
fillp = gc.fillp()
if rgbFace:
This is |check_gc|:
def check_gc(self, gc, fillcolor=None):
orig_fill = gc._fillcolor
gc._fillcolor = fillcolordelta = self.gc.delta(gc) if delta: self.file.output(*delta) # Restore gc to avoid unwanted side effects gc._fillcolor = orig_fill
It looks like the last line restores it. Might that be the cause?
Yes, I missed that.
@mdboom,
I think a better alternative would be to modify the gc.fillp() method to
take an optional rgbFace arg (not a kwarg); draw_markers would then call
it with that arg, and all other uses would call it without. If the arg
is present, it would be used inside fillp() in place of self._fillcolor.
No description provided.