How do I get the shade of blue that is used as default in matplotlib.pyplot.scatter? When giving the keyword argument c='b', it gives a darker shade of blue. In this documentation of matplotlib.pyplot.scatter, it says the default is supposed to be 'b', yet it looks different.
See example below:
import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.scatter(-1, 0) ax.text(-1, 0, 'Default blue') ax.scatter(1, 0, c='b') ax.text(1, 0, 'Darker blue') ax.set_xlim(-2, 2) 
I'm using Python 3.5 with Matplotlib 2.0.0. The reason why I'm asking this, is because I would like to use the same blue colour when plotting some of the points one by one with plt.plot().
The default interactive figure background color has changed from grey to white, which matches the default background color used when saving. in your matplotlibrc file.
To change the color of a scatter point in matplotlib, there is the option "c" in the function scatter.
plt. style. use('default') worked for me. As I understand this, it tells matplotlib to switch back to its default style mode.
The default colour cycle was changed in matplotlib version 2 as shown in the docs.
Therefore, to plot the "new" default blue you can do 2 things:
fig, ax = plt.subplots() ax.scatter(-1, 1) ax.text(-0.9, 1, 'Default blue') ax.scatter(1, 1, c='#1f77b4') ax.text(1.1, 1, 'Using hex value') ax.scatter(0, 0.5, c='C0') ax.text(0.1, 0.5, 'Using "C0" notation') ax.set_xlim(-2, 3) ax.set_ylim(-1,2) plt.show() Which gives:

Alternatively you can change the colour cycle back to what it was:
import matplotlib as mpl from cycler import cycler mpl.rcParams['axes.prop_cycle'] = cycler(color='bgrcmyk')
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