-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
PDF output does not respect zorder when using imshow #2517
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
I think this comes from the fact that in the vector backends, images are "simplified" into a single image. We should probably discuss whether we want to continue doing that or perhaps make it optional. |
I could have sworn it was optional already.... http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure (see suppressComposite). It turns out you can configure the behaviour on the figure, but not on the Axes. To fix this on PDF output one would need to override the "option_image_nocomposite" method on the renderer (PDF renderer in this case). |
@pelson This seems to be an already fixed case, closing. Please re-open if I am confused. |
Having the same problem. As normal user, how do I fix this? Inserting this does not work, nor does False: fig = plt.figure()
fig.suppressComposite = True |
Ah, I was confused when I closed closed this before. |
@Khodeir It looks like you were working on this, did that ever turn into a PR? |
@stretch97 I could have sworn that we fixed this as part of a different issue... |
This is fixed by #4061 Adding matplotlib.rcParams['image.composite_image'] = False to the script suppresses the compositing of images which lets z-order be respected (but makes your pdf files bigger). |
I already posted this as a question on Stack Overflow.
Minimal example:
When exporting to PNG, the output is as expected:

However, when saving to PDF, the zorder is not respected (the line is plotted over both images):

Is this a bug?
The text was updated successfully, but these errors were encountered: