I found this bug by an accident while using a custom ".mplstyle" on Matplotlib 3.5.0
Seems like this rcParam ['figure.autolayout'] = 'True' destroys about 2/3 of the eps file.
plt.tightlayout() seem to not affect the result, the bug happens only with this rcParam on the latest matplotlib version.
importmatplotlib.pyplotaspltplt.plot([1, 2, 3], [1, 2, 3], 'o-')
plt.title(r'$\sum_{i=0}^{\infty} x_i$ just a test')
plt.savefig('test2.eps', format='eps')
Same here with version 3.5.1 in archlinux.
And some lines are lost at the end of broken eps, like gsave, grestore things:
FontName currentdict end definefont pop
end
%%EndProlog
mpldict begin
68.4 288 translate
475.2 216 0 0 clipbox
-gsave
-0 0 m
-475.2 0 l
-475.2 216 l
-0 216 l
-cl
-1.000 setgray
-fill
-grestore
-
-................ more lines
-
-gsave
-
-384.960000 50.672828 translate
-0.000000 rotate
-0.000000 0 m /T glyphshow
-grestore
end
showpage
Activity
jklymak commented on Dec 11, 2021
I can confirm this, but I don't understand it. If you instead do
it works fine.
If you use the rcParam and save as PDF it works fine. So I'm not sure why the ps backend is doing something different.
jklymak commented on Dec 11, 2021
Same behaviour with plt.rcParams['figure.constrained_layout.use'] = True.
alex180500 commented on Dec 13, 2021
Still not fixed in 3.5.1
jklymak commented on Dec 13, 2021
someone will have to dig into it before it gets fixed.
QuLogic commented on Dec 16, 2021
I'm not sure how you got this to work, I see no appreciable difference in the file between the rcParam vs the parameter (i.e., both are broken).
jklymak commented on Dec 16, 2021
Oh good, I must have been mixing up files somehow. Glad that it is consistent between the ways to set tight_layout...
alex180500 commented on Dec 16, 2021
I've just tested it out and...
gives a broken result like with the rcParam.
But
does not. 🤔
shmilee commented on Apr 3, 2022
Same here with version 3.5.1 in archlinux.
And some lines are lost at the end of broken eps, like gsave, grestore things: