Module plottools.tag

Tag axes with a label.

Figure member functions

  • tag(): tag each axes with a label.

Settings

matplotlib.rcParams defined by the tag module:

figure.tags.xoffs : 'auto',
figure.tags.yoffs : 'auto',
figure.tags.label : '%A',
figure.tags.minorlabel : '%A%mi',
figure.tags.font  : dict(fontsize='x-large', fontfamily='sans-serif')

Install/uninstall tag functions

You usually do not need to call these functions. Upon loading the tag module, install_tag() is called automatically.

Functions

def tag(fig=None, axes=None, xoffs=None, yoffs=None, labels=None, minor_label=None, major_index=None, minor_index=None, **kwargs)

Tag each axes with a label.

Labels are left/top aligned.

Parameters

fig : matplotlib figure
If None take figure from first element in axes.
axes : None or matplotlib axes or int or list of matplotlib axes or int
If None label all axes of the figure. Integers in the list are indices to the axes of the figure. For axes in the out list, labels is used for tagging, for axes in (optional) inner lists, minor_label is used.
xoffs : float, 'auto', or None
X-coordinate of label relative to origin of axis in multiples of the width of a character (simply 60% of the current font size). If 'auto' and this is the first call of this function on the figure, set it to the distance of the right-most axis to the left figure border, otherwise use the value computed by the first call. If None take value from mpl.rcParams['figure.tags.xoffs'].
yoffs : float, 'auto', or None
Y-coordinate of label relative to top end of left yaxis in multiples of the height of a character (the current font size). If 'auto' and this is the first call of this function on the figure, set it to the distance of the top-most axis to the top figure border, otherwise use the value computed by the first call. If None take value from mpl.rcParams['figure.tags.yoffs'].
labels : string or list of strings

If string, then replace formatting substrings '%A', '%a', '%1', '%i', and '%I' to generate labels for each axes in the outer list.

  • '%A': A B C …
  • '%a': a b c …
  • '%1': 1 2 3 …
  • '%i': i ii iii iv …
  • '%I': I II III IV …

Subsequent calls to tag() keep incrementing the label. With a list arbitary labels can be specified. If None, set to mpl.rcParams['figure.tags.label'].

minor_label : string
If axes is a nested list of axes, then for the inner lists minor_label is used for formatting the axes label. Formatting substrings '%A', '%a', '%1', '%i', and '%I' are replaced by the corresponding tags for the outer list, '%mA', '%ma', '%m1', '%mi', and '%mI' are replaced by the equivalently formatted tags for the inner list. See labels for meaning of the formatting substrings. If None, set to mpl.rcParams['figure.tags.minorlabel'].
major_index : int or None
Start labeling major axes with this index (0 = 'A'). If None, use last index from previous call to tag().
minor_index : int or None
Start labeling minor axes with this index (0 = 'A'). If None, start with 0.
kwargs : dict
Key-word arguments are passed on to ax.text() for formatting the tag label. Overrides settings in mpl.rcParams['figure.tags.font'].
def tag_params(xoffs=None, yoffs=None, label=None, minor_label=None, font=None)

Set default tag appearance.

Only parameters that are not None are updated.

Parameters

xoffs : float or 'auto'
X-coordinate of tag relative to origin of axis in multiples of the width of a character (simply 60% of the current font size). If 'auto', set it to the distance of the right-most axis to the left figure border, or to a previously computed value from that figure. Sets rcParam figure.tags.xoffs.
yoffs : float or 'auto'
Y-coordinate of tag relative to top end of left yaxis in multiples of the height of a character (the current font size). If 'auto', set it to the distance of the top-most axis to the top figure border, or to a previously computed value from that figure. Sets rcParam figure.tags.yoffs.
label : string
Label used to tag axes. Sets rcParam figure.tags.label. See tag() for details.
minor_label : string
Label used to tag minor axes. Sets rcParam figure.tags.minorlabel. See tag() for details.
font : dict
Dictionary with font settings for tags (e.g. fontsize, fontfamiliy, fontstyle, fontweight, bbox, …). Updates rcParam figure.tags.font.
def install_tag()

Install functions of the tag module in matplotlib.

See Also

uninstall_tag()

def uninstall_tag()

Uninstall all code of the tag module from matplotlib.

See Also

install_tag()

def demo()

Run a demonstration of the tag module.