Created
March 1, 2018 20:20
-
-
Save GeorgeSeif/3056d585140acfc2a05816c39569255e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def boxplot(x_data, y_data, base_color="#539caf", median_color="#297083", x_label="", y_label="", title=""): | |
_, ax = plt.subplots() | |
# Draw boxplots, specifying desired style | |
ax.boxplot(y_data | |
# patch_artist must be True to control box fill | |
, patch_artist = True | |
# Properties of median line | |
, medianprops = {'color': median_color} | |
# Properties of box | |
, boxprops = {'color': base_color, 'facecolor': base_color} | |
# Properties of whiskers | |
, whiskerprops = {'color': base_color} | |
# Properties of whisker caps | |
, capprops = {'color': base_color}) | |
# By default, the tick label starts at 1 and increments by 1 for | |
# each box drawn. This sets the labels to the ones we want | |
ax.set_xticklabels(x_data) | |
ax.set_ylabel(y_label) | |
ax.set_xlabel(x_label) | |
ax.set_title(title) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment