I have to create some plots that I want to integrate into a scientific document. Due to space limitations the size of the plot as well as the font size is rather small.
For debugging/convenience reasons it would be nice to interactively show the plot using plt.show() with a larger size for the plot and fonts, before storing it as a PDF file using fig.savefig(...) with smaller sizes.
I achieved to set a different plot size before displaying it. However, I was not able to update the font size. Any ideas how this would be possible?
#!/usr/bin/env python
import matplotlib as mpl
from pylab import *
params = {
'text.usetex': True,
'font.size': 6,
}
mpl.rcParams.update(params)
fig = plt.figure(figsize=(3,2))
ax = fig.add_subplot(111)
x = [1, 2, 3]
y = [2, 2, 2]
ax.plot(x,y, label='label')
plt.tight_layout()
fig.savefig('plot.pdf')
fig.set_size_inches(10, 8, forward=True)
params = {'font.size': 20}
mpl.rcParams.update(params)
plt.show()
I am using Matplotlib 2.0.2, but also tried 1.5.3.