Python ProgrammingPython Programming

Change Boxplot marker style, marker color and marker size

Change marker color and size

import matplotlib.pyplot as plt
import pandas as pd

df = pd.DataFrame([[10, 20, 30, 40], [7, 14, 21, 128], [15, 15, 89, 12],
                   [-15, 14, 1, 8], [7, -11, 1, 8], [5, 4, 9, 2]],
                  columns=['Apple', 'Orange', 'Banana', 'Pear'],
                  index=['Basket1', 'Basket2', 'Basket3', 'Basket4',
                         'Basket5', 'Basket6'])


flierprops = dict(marker='+', markerfacecolor='g', markersize=15,
                  linestyle='none', markeredgecolor='r')

df.boxplot(['Apple', 'Orange', 'Banana', 'Pear'], flierprops=flierprops)


plt.show()

The following is the output that will be obtained:


Change marker style, marker color and marker size in Boxplot Matplotlib