According to the documentation, the Axes.boxplot
function takes a dictionary flierprop
as argument to define the properties of the outliers. Unfortunately, I can't find the documentation concerning this dictionary. In particular, I would like to define the color of the border of the marker.
By default, empty circles are drawn. One can set the face color, as shown in the example. Nevertheless, the circle border is always a black line. I tried with the keys color
and markercolor
(the former has no effect, the latter produces an error).
What should I do to set a color for the marker line?
To set marker color use property markerfacecolor
but for border color - markeredgecolor
:
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)
# plot. Set color of marker edge
flierprops = dict(marker='o', markerfacecolor='r', markersize=12,
linestyle='none', markeredgecolor='g')
plt.boxplot(data, flierprops=flierprops)
plt.show()
According to @Spiros the flierprops dictionary is documented here like other boxplot properties: http://matplotlib.org/users/dflt_style_changes.html?highlight=flierprops#boxplot