You can configure matplotlib in various ways.
If you want to configure on the whole computer, then matplotlib uses the matplotlibrc configuration file by default.
If you want to edit this to change the default axes of facecolor (the technical term for the background), you need to uncomment and edit this line:
#axes.facecolor : white # axes background color
If you want to set the background color to #CCCCCC , you must change the line to:
axes.facecolor : CCCCCC # axes background color
NB , if you reinstall matplotlib, it will be overwritten. To prevent this, you can save it in "HOME / .matplotlib / matplotlibrc", as indicated in the example comments.
If you want to temporarily change it to a different color, just add the following to the top of the script:
import matplotlib as mpl mpl.rcParams['axes.facecolor'] = '111111'
If you want to change a single matplotlib.axes object, just use ax.set_axis_bgcolor('...') .
Ffisegydd
source share