publiplots.add_reference_line¶
- publiplots.add_reference_line(ax, value, axis='y', color='red', linestyle='--', linewidth=1.5, alpha=0.7, label=None, zorder=1)[source]¶
Add a reference line to the plot.
Useful for showing thresholds, means, or other reference values.
- Parameters:
ax (Axes) – Matplotlib axes object.
value (float) – Position of the reference line.
axis (str, default='y') – Which axis to add line to: ‘x’ (vertical) or ‘y’ (horizontal).
color (str, default='red') – Line color.
linestyle (str, default='--') – Line style.
linewidth (float, default=1.5) – Line width.
alpha (float, default=0.7) – Line transparency (0-1).
label (str, optional) – Label for legend.
zorder (int, default=1) – Z-order (higher values are on top).
Examples
Add horizontal reference line at y=0: >>> pp.add_reference_line(ax, value=0, axis=’y’, label=’Baseline’)
Add vertical line at x=5: >>> pp.add_reference_line(ax, value=5, axis=’x’, color=’blue’)