Skip to content Skip to sidebar Skip to footer

Matplotlib Differentiate Between Mean And Median With Colour Or Shape

I am using matplotlib version 1.4.3 and I wanted to make a Violinplot and I wanted to show the mean and the median, which is easy to do but I want to mark the mean and median so th

Solution 1:

Hint: when looking at a method's docstring never miss the Returns part.

data = np.random.weibull(1.5, size=(1000, 3))
r = plt.violinplot(dataset=data, showmeans=True, showmedians=True,
                   widths=1.0, showextrema=False)
r['cmeans'].set_color('b')
r['cmedians'].set_color('g')

enter image description here


Post a Comment for "Matplotlib Differentiate Between Mean And Median With Colour Or Shape"