trevismd / statannotations

add statistical significance annotations on seaborn plots. Further development of statannot, with bugfixes, new features, and a different API.
Other
624 stars 67 forks source link

Code for FacetGrid example #88

Closed racng closed 9 months ago

racng commented 1 year ago

Hi, where can I find the code for producing the FacetGrid example here? It is the image example_2facts.png stored in the usage/ folder in this repository. Thank you!

https://github.com/trevismd/statannotations/blob/master/usage/example_2facets.png

xinyuejohn commented 1 year ago

Could you please also provide examples of using plot_and_annotate and plot_and_annotate_facets functions. It will help a lot. Thank you!

trevismd commented 1 year ago

Hello, @racng , Sorry for the late reply. The code for this exact example is not yet published (it's meant to be part of the second part of the tutorial). I just gave some indications in #89 about its usage, though.

Please let me know if you have any specific questions or trouble making it work, I'll gladly address that as the feature is not yet properly explained.

trevismd commented 1 year ago

(@xinyuejohn, for a quick reference, here is also an example of plot_and_annotate from the test) https://github.com/trevismd/statannotations/blob/2a5ebe1a4d90c641552db580f3f285559e1bb277/tests/test_integrate_annotator.py#L58-L69

trevismd commented 9 months ago

For anyone looking for this, until it is explained in greater details, the code for the image referenced:


annot = Annotator(None, pairs)

g = sns.FacetGrid(sf, col='State', height=12, sharey=False)
g.map_dataframe(annot.plot_and_annotate_facets, plot='boxplot',
                plot_params=plotting_parameters,
                configuration={"test": "Mann-Whitney"}, annotation_func="apply_test",
                ax_op_before=[["set_yscale", ["log"], {}]])
g.set_axis_labels("Technology Subcategory", "Goal")
g.fig.patch.set_alpha(1)
plt.show()