This only changed it for chart titles, but left axis titles the default color:
import matplotlib as mpl
mpl.rcParams['text.color'] = 'blue'
Plot x and y using plot() method, where color of line is red and label is "y=exp(x)". To place the legend, use legend() method with location of the legend and store the returned value to set the color of the text. To set the color of the text, use set_color() method with green color.
MatPlotLib with Python The default color of a scatter point is blue. To get the default blue color of matplotlib scatter point, we can annotate them using annotate() method.
The default font has changed from "Bitstream Vera Sans" to "DejaVu Sans".
You can set each text property separately, e.g.:
COLOR = 'blue'
mpl.rcParams['text.color'] = COLOR
mpl.rcParams['axes.labelcolor'] = COLOR
mpl.rcParams['xtick.color'] = COLOR
mpl.rcParams['ytick.color'] = COLOR
The full list of params is at https://matplotlib.org/users/customizing.html.
To set the label color in the rcParams as well use
text.color: blue
axes.labelcolor: blue
or, from within the script
mpl.rcParams.update({'text.color' : "blue",
'axes.labelcolor' : "blue"})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With