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)

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


Continue reading:—-7f60cf5620c9—4