An important aspect is patch_artist=Truecall setup boxplot.
import numpy as np
import matplotlib.pyplot as plt
spread= np.random.rand(50) * 100
center = np.ones(25) * 50
flier_high = np.random.rand(10) * 100 + 100
flier_low = np.random.rand(10) * -100
data = np.concatenate((spread, center, flier_high, flier_low), 0)
bp = plt.boxplot(data, patch_artist=True)
for box in bp['boxes']:
box.set(color='red', linewidth=2)
box.set(facecolor = 'green' )
box.set(hatch = '/')
plt.show()
boxplot. patch_artist=True. , :
AttributeError: 'Line2D' 'set_facecolor'
boxplot demo 2 , . patch_artist.
. hatch. :
