Skip to content
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

Merged
merged 1 commit into from Oct 22, 2012

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Oct 17, 2012

No description provided.

@dmcdougall
Copy link
Member

@mdboom Does this work with alpha transparency?

@mdboom
Copy link
Member Author

mdboom commented Oct 17, 2012

alpha works to the extent that it always did -- i.e. not a lot of fine control. This only addresses the case where mfc="none".

@dmcdougall
Copy link
Member

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:
Copy link
Member

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.

Copy link
Member

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?

Copy link
Member

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)
return

     self.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 = 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?

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.

@dmcdougall dmcdougall merged commit 715cd8d into matplotlib:v1.2.x Oct 22, 2012
@mdboom mdboom deleted the transparent_pdf_markers branch March 3, 2015 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants