1
+ ### IMPORT PLOTASTIC
2
+ import plotastic as plst
3
+
4
+ # IMPORT EXAMPLE DATA
5
+ DF , _dims = plst .load_dataset ("fmri" , verbose = False )
6
+ # EXPLICITLY DEFINE DIMENSIONS TO FACET BY
7
+ dims = dict (
8
+ y = "signal" , # y-axis, dependent variable
9
+ x = "timepoint" , # x-axis, independent variable (within-subject factor)
10
+ hue = "event" , # color, independent variable (within-subject factor)
11
+ col = "region" , # axes, grouping variable
12
+ )
13
+ # INITIALIZE DATAANALYSIS OBJECT
14
+ DA = plst .DataAnalysis (
15
+ data = DF , # Dataframe, long format
16
+ dims = dims , # Dictionary with y, x, hue, col, row
17
+ subject = "subject" , # Datapoints are paired by subject (optional)
18
+ verbose = False , # Print out info about the Data (optional)
19
+ )
20
+ # STATISTICAL TESTS
21
+ DA .check_normality () # Check Normality
22
+ DA .check_sphericity () # Check Sphericity
23
+ DA .omnibus_rm_anova () # Perform RM-ANOVA
24
+ DA .test_pairwise () # Perform Posthoc Analysis
25
+ # PLOTTING
26
+ (
27
+ DA .plot_box_strip ().annotate_pairwise ( # Pre-built plotting function initializes plot # Annotate results from DA.test_pairwise()
28
+ include = "__HUE" # Use only significant pairs across each hue
29
+ )
30
+ )
31
+
32
+
33
+ ### BACK-CHECK
34
+ import seaborn as sns
35
+ sns .catplot (data = DF , ** _dims )
0 commit comments