label_axes

typhon.plots.label_axes(axes=None, labels=None, loc=(0.02, 0.9), **kwargs)[source]

Walks through axes and labels each.

Parameters:
  • axes (iterable) – An iterable container of AxesSubplot.

  • labels (iterable) – Iterable of strings to use to label the axes. If None, first upper and then lower case letters are used.

  • loc (tuple of floats) – Where to put the label in axes-fraction units.

  • **kwargs – Additional keyword arguments are collected and passed to annotate().

Examples

import matplotlib.pyplot as plt
from typhon.plots import label_axes, styles


plt.style.use(styles('typhon'))

# Automatic labeling of axes.
fig, axes = plt.subplots(ncols=2, nrows=2)
label_axes()

# Manually specify the axes to label.
fig, axes = plt.subplots(ncols=2, nrows=2)
label_axes(axes[:, 0])  # label each row.

# Pass explicit labels (and additional arguments).
fig, axes = plt.subplots(ncols=2, nrows=2)
label_axes(labels=map(str, range(axes.size)), weight='bold')

(Source code)

../_images/typhon-plots-label_axes-1_00.png

Fig. 6 (png, hires.png, pdf)

../_images/typhon-plots-label_axes-1_01.png

Fig. 7 (png, hires.png, pdf)

../_images/typhon-plots-label_axes-1_02.png

Fig. 8 (png, hires.png, pdf)