Skip to content

Error in Agg backend's PNG renderer when markeredgewidth > markersize #16621

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

Closed
brunobeltran opened this issue Mar 1, 2020 · 6 comments
Closed
Labels
backend: agg status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. status: inactive Marked by the “Stale” Github Action

Comments

@brunobeltran
Copy link
Contributor

Bug report

Bug summary

Whenever the edge width of a marker is increased beyond the size of the marker, you would want the marker to

Code for reproduction

import matplotlib.pyplot as plt
for i in range(0, 150, 20):
    fig, ax = plt.subplots()
    lines = ax.plot(0, 0, marker='p', markersize=60, markeredgewidth=i, 
                    markeredgecolor='k', clip_on=False)
    plt.xlim([-0.04, 0.04])
    plt.ylim([-0.04, 0.04])
    plt.savefig(f'/home/bbeltr1/Downloads/test_{i}.png')
fig._cachedRenderer

Actual outcome

While the outer extents of the pentagon's edge appear correct, you can see that the inner extents begin to recede away from the center as the edge width is set larger and larger, until eventually the original marker is fully visible again, along with some of the background.

Console output:
<matplotlib.backends.backend_agg.RendererAgg at 0x7f5277bf0e80>

Saved images:
test_0
test_20
test_40
test_60
test_80
test_100
test_120
test_140

Expected outcome

The expected outcome is a fully-shaded pentagon (due to the edge being huge). My PDF backend does this correctly, as seen below in a screenshot of what test_140.pdf looks like if I save as 'test_{i}.pdf' instead:

test_140 pdf

Matplotlib version

  • Operating system: Debian 9
  • Matplotlib version: 3.1.3
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline is what gets printed, and inline plots also show this error, but I can take Jupyter out of the loop by saving directly to file. Both cases are apparently using RendererAgg to make the PNG, as seen above.
  • Python version: 3.7.3
  • Jupyter version (if applicable):
  • Other libraries:

Matplotlib was installed and updated via the default conda channel.

@brunobeltran
Copy link
Contributor Author

I'm sure whoever (if anyone) eventually tackles this will notice, but this looks like a typical "even/odd" vs "non-zero" fill style mix up (see e.g. https://www.slideshare.net/Mark_Kilgard/22pathrender, slide 21).

@tacaswell
Copy link
Member

I wonder if mplcairo has this problem...

That is wild how did you find this?

@QuLogic
Copy link
Member

QuLogic commented Mar 9, 2020

This does not affect mplcairo:
image

@anntzer
Copy link
Contributor

anntzer commented Mar 9, 2020

This also doesn't seem to affect mplcairo even if setting the fill rule (with cairo_set_fill_rule) to even-odd (the default is nonzero).

@brunobeltran
Copy link
Contributor Author

I wonder if mplcairo has this problem...

That is wild how did you find this?

Writing tests for #16607, of course wanted to make sure formulas work in fat/thin marker edge cases.

@github-actions
Copy link

This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Jul 10, 2023
@github-actions github-actions bot added the status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. label Aug 11, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: agg status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. status: inactive Marked by the “Stale” Github Action
Projects
None yet
Development

No branches or pull requests

5 participants