Modifying rcParams

If you want to modify the size of a figure without using the figure environment, then you can also update matplotlib.rcParams which is an instance of RcParams for handling default Matplotlib values.

import matplotlib.pyplot as pltplt.rcParams['figure.figsize'] = (3, 2)x = y = range(1, 10)plt.plot(x, y)
plt.show()

Note that the above will have effect on every figure generated unless you specify different size for a specific figure. If for any reason you want to set back the default values of this parameter, you can simply use rcParamsDefault as shown below

plt.rcParams['figure.figsize']=plt.rcParamsDefault['figure.figsize']

Continue reading: https://towardsdatascience.com/change-figure-size-matplotlib-11a409f39584?source=rss—-7f60cf5620c9—4

Source: towardsdatascience.com