Last active
July 22, 2021 20:46
-
-
Save trevismd/8f63163fa57ff4798459bf03fc227074 to your computer and use it in GitHub Desktop.
Annotating Plot 1
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
# Putting the parameters in a dictionary avoids code duplication | |
# since we use the same for `sns.boxplot` and `Annotator` calls | |
plotting_parameters = { | |
'data': rfs, | |
'x': 'Subcategory', | |
'y': 'Goal', | |
'palette': subcat_palette[1:] | |
} | |
pairs = [('Robots', 'Flight'), | |
('Flight', 'Sound'), | |
('Robots', 'Sound')] | |
with sns.plotting_context('notebook', font_scale = 1.4): | |
# Create new plot | |
ax = get_log_ax() | |
# Plot with seaborn | |
sns.boxplot(**plotting_parameters) | |
# Add annotations | |
annotator = Annotator(ax, pairs, **plotting_parameters) | |
annotator.set_custom_annotations(formatted_pvalues) | |
annotator.annotate() | |
# Label and show | |
label_plot_for_subcats(ax) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment