I found this related, older question. Sadly. the error_kw
does not exist anymore (using matplotlib version 1.5.0). The capprops
dictionary indeed only works on the cap.
I would like to change the line that extends from the box to the cap. Default is dashed blue, as seen below. I tried all the documented format dicts, but none of them is responsible for this line.
These are the "whiskers" and are returned by boxplot
. Iterate over them and set the style accordingly:
import matplotlib.pyplot as plt
import numpy as np
# fake up some data
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)
plt.figure()
bp = plt.boxplot(data, 1)
for whisker in bp['whiskers']:
whisker.set(color='#ff0000',lw=2)
plt.show()