publiplots.adjust_spines

publiplots.adjust_spines(ax, spines='left-bottom', color='0.2', linewidth=1.5, offset=None)[source]

Adjust which spines are visible and their appearance.

Parameters:
  • ax (Axes) – Matplotlib axes object.

  • spines (str or List[str], default='left-bottom') – Which spines to show. Can be: - ‘all’: Show all spines - ‘none’: Hide all spines - ‘left-bottom’: Show only left and bottom (default for publiplots) - ‘box’: Show all four spines (box around plot) - List of spine names: [‘left’, ‘bottom’, ‘right’, ‘top’]

  • color (str, default='0.2') – Color of visible spines.

  • linewidth (float, default=1.5) – Width of visible spines.

  • offset (float, optional) – Offset spines from data by this amount in points.

Examples

Show only left and bottom spines (publication style): >>> pp.adjust_spines(ax, spines=’left-bottom’)

Show all spines: >>> pp.adjust_spines(ax, spines=’all’)

Hide all spines: >>> pp.adjust_spines(ax, spines=’none’)

Custom spine selection: >>> pp.adjust_spines(ax, spines=[‘left’, ‘right’])