alphapepttools.pl.add_lines#
- alphapepttools.pl.add_lines(ax, intercepts, linetype='vline', color='black', linestyle='--', linewidth=1, line_kwargs=None)#
Add vertical or horizontal reference lines to a plot
Useful for adding threshold lines to volcano plots, zero lines to bar plots, or any other reference lines to visualizations.
- Parameters:
ax (
Axes) – Matplotlib axes object to add lines tointercepts (
float|list[float|int]) – Single value or list of x-positions (vline) or y-positions (hline)linetype (
str(default:'vline')) – Type of line:"vline"(vertical) or"hline"(horizontal)color (
str(default:'black')) – Line colorlinestyle (
str(default:'--')) – Line style (e.g.,"--","-",":")linewidth (
float(default:1)) – Line width, defaults toconfig["linewidths"]["medium"]line_kwargs (
dict|None(default:None)) – Additional matplotlib line arguments. Note: explicit color, linestyle, and linewidth parameters take precedence
- Return type:
Examples
Add significance thresholds to a volcano plot:
# Add fold-change thresholds add_lines(ax, intercepts=[-1, 1], linetype="vline", color="red", linestyle=":") # Add p-value threshold add_lines(ax, intercepts=-np.log10(0.05), linetype="hline", color="blue", linestyle="--")
Add zero reference to bar plot:
ax.bar(x, heights) add_lines(ax, intercepts=0, linetype="hline", color="black")