You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pdf-backend for savefig produces unusual grouping within pdf element #15051
When saving the figure as a PDF, the items are grouped unusually, which leads to unexpected results when shown in a viewer that supports knockout effects.
While this is not problematic most of the time, the issue causes troubles if the PDF created by matplotlib is edited within Illustrator (possibly other PDF editors as well).
In the Adobe Illustrator forum I got the feedback that the grouping of the items is unusual and causes the confusion. Indeed, ungrouping the elements resolved all of my problems.
Here you are. Since Illustrator supports different versions of PDF, I've picked the newest and oldest available version (1.3 and 1.7).
I used the above sample code to create the PDF (sample-original.pdf). The only action performed in Illustrator was to ungroup the items (Cmd+Shift+G), followed by "Save as".
Activity
anntzer commentedon Aug 13, 2019
I can repro this issue with mupdf/ghostscript, but not with poppler (okular). Not sure whether it's the readers not following the spec, or not.
fwiw https://github.com/matplotlib/mplcairo generates pdfs without this issue.
jkseppan commentedon Jul 28, 2020
Since ungrouping in Adobe Illustrator solves the problem, could you share
(1) a small problematic file from matplotlib;
(2) the same file after ungrouping in Illustrator and saving as PDF?
normanius commentedon Jul 28, 2020
Here you are. Since Illustrator supports different versions of PDF, I've picked the newest and oldest available version (1.3 and 1.7).
I used the above sample code to create the PDF (sample-original.pdf). The only action performed in Illustrator was to ungroup the items (Cmd+Shift+G), followed by "Save as".
sample-original.pdf
sample-ungrouped-pdf1.3.pdf
sample-ungrouped-pdf1.7.pdf
QuLogic commentedon Jul 28, 2020
I don't think we set knockout groups; I think this is an implicit behaviour in PDF:


QuLogic commentedon Jul 28, 2020
So I think that makes this a duplicate of #10035.