Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Description
Feature Request
I'm new to matplotlib and I don't know if there is a specific reason for the boxplot fill coloring to be the way it is. I only wonder if it could be done in a more straight forward manner than what is shown inhere.
The idea for this "new feature" would be to use acolor
parameter that recieves either a list of supported colors or a single color (e.g.color = 'red'
) that specifies the colors to be applied to each one of the boxplots in the ax.
How it is currently done
importmatplotlib.pyplotaspltimportnumpyasnpdata= [np.random.normal(0,std,1000)forstdinrange(1,6)]box=plt.boxplot(data,notch=True,patch_artist=True)colors= ['cyan','lightblue','lightgreen','tan','pink']forpatch,colorinzip(box['boxes'],colors):patch.set_facecolor(color)plt.show()
The idea for this 'New Feature'
importmatplotlib.pyplotaspltimportnumpyasnpdata= [np.random.normal(0,std,1000)forstdinrange(1,6)]colors= ['cyan','lightblue','lightgreen','tan','pink']# or maybe 'c = colors', 'face_colors = colors'...plt.boxplot(data,notch=True,colors=colors)plt.show()
Any thoughts on this idea?
Matplotlib version
- Operating system: Windows 10 2004
- Matplotlib version: 3.2.2
- Matplotlib backend (
print(matplotlib.get_backend())
): TkAgg - Python version: 3.7.7
- Jupyter version (if applicable): 2.1.5
- Other libraries: