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 (matplotlib.axes.Axes) – Axes to modify in place.

  • spines (str or list of str, default 'left-bottom') –

    Which spines to show. Accepted values:

    • 'all' — show all four spines.

    • 'none' — hide all spines.

    • 'left-bottom' — show only left and bottom (publiplots default).

    • 'box' — equivalent to 'all'.

    • A list of spine names (subset of ['left', 'bottom', 'right', 'top']).

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

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

  • offset (float, optional) – Offset visible spines outward from the data by this many points. None leaves the spine position alone.

Returns:

ax is modified in place.

Return type:

None

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 with an outward offset:

>>> pp.adjust_spines(ax, spines=['left', 'bottom'], offset=3)