Skip to content

different pair/statistics in same plot with several Annotator #190

@pas-calc

Description

@pas-calc

Given a dataset with two groups across time. We want to apply and annotate stats both independent (group1, time1) - (group1,time2) and paired (group1, time1) - (group1, time2)

From the examples it is not clear whether this can be done with one annotator?

statannotations.Annotator.Annotator has in its init a data and pair parameter, so the pairs need to be defined on initialization.
But apply/annotate, there we define the statistic.

So we need two Annotator instances and do like this?

annotator = Annotator(ax=ax, pairs=pairs_paired, plot="boxplot", data=data, x="condition", y="value", hue="group")
annotator.configure(test="t-test_paired") # within group, across time condition
annotator.apply_and_annotate()
annotator = Annotator(ax=ax, pairs=pairs_across_groups, plot="boxplot", data=data, x="condition", y="value", hue="group")
annotator.configure(test="t-test_ind")
annotator.apply_and_annotate()

However then the annotator instances do not know about each other and label can overlap, as shown below?

Image

It could be fixed by forcing the stat across pairs (ttest-independent) to be on fixed y-value
#189

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions