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
# With ... = all parameters passed to seaborn's plotter | |
annotator = Annotator(ax, pairs, ...) |
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
# With ... = all parameters passed to seaborn's plotter | |
annotator = Annotator(ax, box_pairs, ...) |
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
from statannotations.Annotator import Annotator |
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
pairs = [('Robots', 'Flight'), # 'Robots' vs 'Flight' | |
('Flight', 'Sound'), # 'Flight' vs 'Sound' | |
('Robots', 'Sound')] # 'Robots' vs 'Sound' |
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
# pvalues with scipy: | |
stat_results = [ | |
mannwhitneyu(robots, flight, alternative="two-sided"), | |
mannwhitneyu(flight, sound, alternative="two-sided"), | |
mannwhitneyu(robots, sound, alternative="two-sided") | |
] | |
pvalues = [result.pvalue for result in stat_results] | |
print("Robots vs Flight: \n", stat_results[0], "\n") |
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
print("Robots: ", normaltest(robots).pvalue) | |
print("Flight: ", normaltest(flight).pvalue) | |
print("Sound: ", normaltest(sound).pvalue) | |
print() | |
print("Log(robots): ", normaltest(log_robots).pvalue) | |
print("Log(Flight): ", normaltest(log_flight).pvalue) | |
print("Log(Sound): ", normaltest(log_sound).pvalue) |
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
robots = rfs.loc[(rfs.Subcategory == "Robots"), "Goal"].values | |
flight = rfs.loc[(rfs.Subcategory == "Flight"), "Goal"].values | |
sound = rfs.loc[(rfs.Subcategory == "Sound"), "Goal"].values | |
log_robots = np.log(robots) | |
log_flight = np.log(flight) | |
log_sound = np.log(sound) |
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
# [code common to all plots] | |
# Plot with seaborn | |
sns.boxplot(ax=ax, data=rfs, x='State', y='Goal', order=states_order, | |
palette=states_palette) | |
# [code common to all plots] |
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
with sns.plotting_context("notebook", font_scale=1.4): | |
# Create new plot, setting a logarithmic scale for y | |
ax = get_log_ax() | |
# Plot with seaborn | |
sns.boxplot(ax=ax, data=rfs, x='Subcategory', y='Goal', palette=subcat_palette[1:]) | |
# Label (adds axes labels and title), and show | |
label_plot_for_subcats(ax) | |
plt.savefig("plot1.png") |
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
subcat_palette = sns.dark_palette("#8BF", reverse=True, n_colors=5) | |
subcat_order = ['Robots', 'Flight', 'Sound'] |