Skip to content

Instantly share code, notes, and snippets.

@nerevar nerevar/
Last active Jun 4, 2016

What would you like to do?
python neat boxplot #python #matplotlib #boxplot #graph
import matplotlib.pyplot as plt
def draw(data):
bp = plt.boxplot(data,
notch=True, # adds median notch
plt.grid(axis='y', # set y-axis grid lines
linestyle='--', # use dashed lines
which='major', # only major ticks
color='lightgrey', # line colour
alpha=0.7) # make lines semi-translucent
plt.setp(bp['whiskers'], color='DarkMagenta', linewidth=1.5)
plt.setp(bp['caps'], color='DarkMagenta', linewidth=1.5)
plt.setp(bp['boxes'], color='DarkMagenta', linewidth=1.5)
plt.setp(bp['fliers'], color='OrangeRed', marker='o', markersize=10)
plt.setp(bp['medians'], color='OrangeRed', linewidth=1.5)
colors = ['lightgreen', 'lightblue', 'tan', 'pink']
for patch, color in zip(bp['boxes'], colors):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.