0todd0000 / spm1d

One-Dimensional Statistical Parametric Mapping in Python
GNU General Public License v3.0
61 stars 21 forks source link

Overlay SPM Plots #95

Closed fiachra-maguire closed 5 years ago

fiachra-maguire commented 5 years ago

Hi Todd,

Thanks for your work on spm1d!

A quick question, is it reasonable to plot SPM output on one graph?

For example: I am using the GLM function and have three models, each adjusting for an increasing number of relevant covariates. Is it possible to overlay each SPM plot?

As far as I can see, there is no alpha option in the _plotspmi source code (although there is in the _plot_meansd function).

If this is a reasonable idea, perhaps this is something which could be incorporated into future versions of spm1d. If it is unreasonable and perhaps lead to mis-interpretation then it is easy to live with multiple plots of unadjusted/adjusted results.

Thanks again!

0todd0000 commented 5 years ago

Hi, although spm1d does not directly support overlaying, it should be possible to create a custom plot like this using matplotlib.fill_between with face color and/or transparency options. You'd need just the test statistic (spm.z) and the critical threshold (spm.zstar) to create filled patches.

Another option would be to plot a separate row of bars for each model under a plot of means, similar to Figs.5-7 from Simon-Martinez et al. (2017)

Simon-Martinez C, Jaspers E, Mailleux L, Desloovere K, Vanrenterghem J, Ortibus E, Molenaers G, Feys H, Klingels K. Negative influence of motor impairments on upper limb movement patterns in children with unilateral cerebral palsy. A statistical parametric mapping study. Frontiers in Human Neuroscience. 2017 Oct 5;11:482.