I'm looking for suggestions on how to add significance bars between boxes on a box plot and also have asterisks representing significance. I am using seaborn to create plots and I couldn't find any common methods for accomplishing this. Nothing stuck out to me in the documentation but I am a novice and new to matplotlib in general so I wouldn't be surprised if I overlooked something.
I would like to be able to do something similar to this plot using R, but with python
@UlrichStern suggested an answer to a previous question that does exactly what I need.
How does one insert statistical annotations (stars or p-values) into matplotlib / seaborn plots?
In layman terms, you plot a line with four x values and four y values.
plt.plot([x1,x1, x2, x2], [y1, y2, y2, y1], linewidth=1, color='k')
The magic for me was here:
[x1, x1, x2, x2]
[y1, y2, y2, y1]
x1 should be the location of whatever box you want to point to and x2 should be the other box you want to point to.
y2 should be where you want the line on the y-axis and y1 is how far down you want the vertical ticks on each end to extend.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With