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 saved as raster graphic when plt.savefig is given a Path object #10753
I use pathlib quite heavily, and just updated my copy of matplotlib to 2.2.0. I was happy to remove lots of explicit conversion from Path to str in my code, e.g. plt.savefig(str(figure_path)) -> plt.savefig(figure_path).
When passing a pathlib.Path object to plt.savefig, I was surprised to see that the plot was saved as a low-resolution raster image in the PDF, rather than a vector graphic.
Activity
jklymak commentedon Mar 11, 2018
Ping @anntzer. I suspect that we can’t tell this is meant to be a PDF. I think there is a kind kwarg.
QuLogic commentedon Mar 11, 2018
Yep, they're not the same format:
You can pass
format='pdf'to be explicit, though it would be great if this could still be figured out from thePath.