In jupyter notebooks recently, I have had matplotlib ignore the rcParams. For example, I will set pl.rcParams['figure.figsize'] = (10, 8), then find that all plots come out with size (6,4). Generally, if I make a plot with some features (not a blank canvas), then set rcParams again, the settings stick.
This example shows the settings not sticking until the second time I create a figure:
pl.rcParams['figure.figsize'] = (10,8)
print(pl.rcParams['figure.figsize'])
pl.rcParams['font.size'] = 16
pl.rcParams['figure.figsize'] = (10,8)
fig = pl.figure()
pl.draw()
ax = fig.gca()
print(fig.get_size_inches())
pl.close(fig.number)
pl.rcParams['figure.figsize'] = (10,8)
fig = pl.figure()
pl.draw()
ax = fig.gca()
print(fig.get_size_inches())
pl.close(fig.number)
result:
[10.0, 8.0]
[6. 4.]
[10. 8.]
This behavior has only begun recently, so I suspect it's a change in matplotlib, but I can't pin it down. I'm using matplotlib 3.5.2.