-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
pcolormesh: masked parts of array render black when saving to PDF with Gouraud shading #11769
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
Comments
(As a reference point: mplcairo does not suffer from this issue, so it "should" be fixable :)) |
Are you sure? It doesn't look the same to me. Maybe it depends on viewer? |
Not exactly the same, but not a black rectangle either. I think interpolating values towards a transparent black isn't quite right, but see #8802 (and if someone who finds this issue has opinions on how the result should look, please comment there). |
Bug report
If a 2D numpy array has NaNs (thereby interpreted by pcolormesh as masked), and pcolormesh is used to plot the array with Gouraud shading, then when saving to a PDF, instead of rendering those cells as transparent (making anything underneath visible), the cells in question are rendered as black. This does not happen with rasterized plots, plots saved to PNG, or plots displayed interactively. This appears to be independent of backend. Simply using imshow is not an option if the data to be plotted is on a non-uniform grid.
Code for reproduction
Actual outcome
With Gouraud shading, written to PDF:

Without Gouraud shading, written to PDF:

With Gouraud shading, written to PNG:

Expected outcome
All three outputs should show map1 in the central rectangle where values have been set to np.nan (i.e. the masked values should be transparent).
Matplotlib version
matplotlib installed via pip
The text was updated successfully, but these errors were encountered: