dotools_py.pl.StatsPlotter

dotools_py.pl.StatsPlotter#

class dotools_py.pl.StatsPlotter(axis, x_axis, y_axis, ctrl, groups, pvals, txt_size=None, txt=None, kind=None, line_offset=None, hue=None, hue_order=None)[source]#

Class to add statistics on bar, box or violin plots.

This class add statistical annotations to bar, box and violin plots. A bracket will connect the control and tested condition and will indicate the p-value. The control and conditions to be tested should be in the x_axis.

Parameters:
axis Axes

matplotlib axis.

x_axis str

name of the x-axis.

y_axis str

name of the y-axis.

ctrl str

name of the control condition. Expected to be present in the xticks.

groups list

list of conditions in the xticks that have been tested.

txt_size int (default: None)

size of the text added.

txt str (default: None)

text to add before the p-value (e.g., p = ). If not set, only the p-value is added.

pvals list

list of p-values for the conditions in groups. Expected to be in the same order. If hue is provided, the order will depend on the groups and the x-ticks (e.g., x-ticks: healthy, disease; and groups: cell1, cell2, then pvals should be cell1_healthy Vs control_healthy, cell2_healthy Vs control_healthy, cell1_disease Vs control_disease, etc.). If hue is specified the number of expected values is len(x_axis groups) * len(hue groups).

kind str (default: None)

type of plot. Available: box, violin, bar.

line_offset float (default: None)

brackets are added in the highest y-value plus this offset. This offset is interpret as a percentage (i.e, a line offset of 0.05 means, we add an offset of 5 % to the height).

hue str (default: None)

name of the variable used to split in subgroups.

hue_order list (default: None)

order of the subgroups. Needs to be specified if hue is defined.

See also

dotools_py.pl.TestData()

useful class to calculate statistics

Methods table#

plot_stats()

Method to add the statistical annotation.

Methods#

StatsPlotter.plot_stats()[source]#

Method to add the statistical annotation.

Returns:

None