Draw annotations#
- starbars.draw_annotation(annotations, ax=None, ns_show=True, bar_gap=0.03, tip_length=0.03, top_margin=0.05, text_distance=0.02, fontsize=10, mode='vertical', line_width=1.5, color='k', text_args=None, line_args=None, h_gap=0.03)#
Draw statistical significance bars and p-value labels between chosen pairs of columns on existing plots.
- Parameters:
annotations (list[tuple[float | str, float | str, float]]) – list of tuples containing the x-axis labels and the p-value of the pair.
ax (matplotlib.axes.Axes) – The axis of subplots to draw annotations on. If ax is not provided, it implies that you are working with a single plot rather than a set of subplots. In such cases, the annotations apply to the only existing plot in the figure.
ns_show – whether to show non-statistical bars. (Default: True)
bar_gap – margin of the bar from data. Default is 3% of the data axis.
tip_length – length of the tip of the bar. Default is 3% of the data axis.
top_margin – margin of the last annotation from the top of the graph. Default is 5% of the data axis.
text_distance – distance between the bar and the text of the text. Default is 2% of the data axis.
fontsize – font size of the annotations. Default is 10.
mode – orientation of the data representation, ‘horizontal’ or ‘vertical’. Default is ‘vertical’.
color – color of the annotations, as matplotlib color value. Default is black.
line_width – width of the line. Default is 1.5.
line_args (dict) – Additional dictionary of arguments which will be passed to ax.plot for drawing lines.
text_args (dict) – Additional dictionary of arguments which will be passed to ax.text for drawing text.
h_gap – gap between two neighbouring annotations. Default is 3% of the cross data axis.