Reputation: 5601
I'm plotting data stored in pandas dataframes through matplotlib, with pd.options.display.mpl_style = 'default'
The plot font is different between the figure that is shown, and the figure that is saved:
Shown figure:
Saved figure:
I realize there are different settings one can apply that will change the look and feel of either individually (matplotlib savefig() plots different from show()), however I haven't been able to find any easy to follow documentation that shows how to set the default fonts while using matplotlib backend: MacOSX. Can someone show how to make the font that appears in the shown figure also appear in the saved figure?
Upvotes: 1
Views: 786
Reputation: 5601
I found what solves the problem incidentally through another script I have. I have no idea why or how this solves the problem... Entering the code below before the plot is called makes it so the font appears the same as in the figure and the saved pdf:
font = {'family' : 'normal'}
matplotlib.rc('font', **font)
Upvotes: 1