publiplots.add_grid¶
- publiplots.add_grid(ax, which='major', axis='both', alpha=0.3, linestyle='--', linewidth=0.5, color='0.8', zorder=0)[source]¶
Add customizable gridlines to axes.
- Parameters:
ax (Axes) – Matplotlib axes object.
which (str, default='major') – Which gridlines to show: ‘major’, ‘minor’, or ‘both’.
axis (str, default='both') – Which axis to add grid: ‘x’, ‘y’, or ‘both’.
alpha (float, default=0.3) – Transparency of gridlines (0-1).
linestyle (str, default='--') – Style of gridlines.
linewidth (float, default=0.5) – Width of gridlines.
color (str, default='0.8') – Color of gridlines.
zorder (int, default=0) – Z-order of gridlines (lower values are behind other elements).
Examples
Add default gridlines: >>> pp.add_grid(ax)
Add only horizontal gridlines: >>> pp.add_grid(ax, axis=’y’)
Customize grid appearance: >>> pp.add_grid(ax, alpha=0.5, linestyle=’:’, color=’blue’)