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 in here.
The idea for this "new feature" would be to use a color
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
import matplotlib.pyplot as plt
import numpy as np
data = [np.random.normal(0, std, 1000) for std in range(1, 6)]
box = plt.boxplot(data, notch=True, patch_artist=True)
colors = ['cyan', 'lightblue', 'lightgreen', 'tan', 'pink']
for patch, color in zip(box['boxes'], colors):
patch.set_facecolor(color)
plt.show()
The idea for this 'New Feature'
import matplotlib.pyplot as plt
import numpy as np
data = [np.random.normal(0, std, 1000) for std in range(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: