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
Style configuration changing behavior of savefig #9671
I recently upgraded to Matplotlib 2.1.0 and for some reason my fig.savefig functionality has changed. Basically, it now requires a bytes-like object whenever a certain style file is used. Running the following code:
TypeError: a bytes-like object is required, not 'str'
at the line that involves the fig.savefig line. Weirdly, removing plt.style.use('aps') removes this error (but gives me the ugly default style).
Fixing this is simple enough on my side (replace the string with the bytes like obj), but this shouldn't be occurring in fig.savefig - thought I would bring it up.
Important info:
MPL version: 2.1.0
System: Windows 7 Ultimate
Tex backend is MikTex 2.9
Python version:
'3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)]'
Just for fun, remove the usetex line... Not saying you should have to do that, but its the only thing in there that looks like it could cause a problem?
Can you modify the Issue with the operating system, versions of MPL, python etc, libraries and tex version you are using? I can't help w/ this (above my pay grade) but its likely necessary info.
FWIW, it works for me, so its something in your setup...
Ah okay, so whatever it was seems to be patched up. I'm working off the latest stable build from PyPi. I've downgraded to Matlab 2.0.2 for now, at least til an official stable patch gets released.
Activity
jasonrobwebster commentedon Nov 2, 2017
I jumped the gun, fixing it is not as simple as I thought. Using
executes properly but the pdf does not open. Changing the extension to png does work (and will even allow fig.savefig to accept a string).
jklymak commentedon Nov 2, 2017
Just for fun, remove the
usetexline... Not saying you should have to do that, but its the only thing in there that looks like it could cause a problem?jasonrobwebster commentedon Nov 2, 2017
That fixes it in so far as I can save a pdf file (and I can use
savefigwith astrinput). Messes up the point of the style file though.jklymak commentedon Nov 2, 2017
Can you modify the Issue with the operating system, versions of MPL, python etc, libraries and tex version you are using? I can't help w/ this (above my pay grade) but its likely necessary info.
FWIW, it works for me, so its something in your setup...
WeatherGod commentedon Nov 2, 2017
jklymak commentedon Nov 2, 2017
Ah, maybe thats it. I'm working off master...
jasonrobwebster commentedon Nov 2, 2017
Ah okay, so whatever it was seems to be patched up. I'm working off the latest stable build from PyPi. I've downgraded to Matlab 2.0.2 for now, at least til an official stable patch gets released.
jklymak commentedon Nov 2, 2017
Closed by #9292 Thanks for the report @jasonrobwebster and sorry I didn't remember that it'd been fixed earlier...