Shading significance along signal traces
Closed this issue · 2 comments
Andres-Jaramillo commented
Dear spm1d and Todd
Sorry in advance for the simple question.
Is there a method already implemented in the "plot class" for plotting/shading the significant regions (along x axis) in the plot on top of the signal traces, as in the plots I attach here?
I was trying to find such in the documentation, code, and here in the forum.
Kind regards to all.
Andres
0todd0000 commented
Hello Andres,
This is not directly supported in the current version of spm1d but can be achieved using Matplotlib's axvspan. You can use cluster.endpoints
to get the relevant x-axis positions, for example:
spmi = spm1d.stats.ttest2(y1, y0).inference(0.05)
x0,x1 = spmi.clusters[0].endpoints
plt.axvspan(x0, x1, color='red', alpha=0.5)
Andres-Jaramillo commented
Dear Todd,
That just worked perfectly!
Thanks