Module plottools.tag
Tag axes with a label.
Figure member functions
tag(): tag each axes with a label.
Settings
tag_params(): set default tag appearance.
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.
install_tag(): install functions of the tag module in matplotlib.uninstall_tag(): uninstall all code of the tag module from matplotlib.
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:Noneormatplotlib axesorintorlistofmatplotlib axesorint- 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,
labelsis used for tagging, for axes in (optional) inner lists,minor_labelis used. xoffs:float, listoffloat, 'auto',orNone- 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 list, use for each column of axes (estimated from their positions)
the corresponding offset.
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, listoffloat, 'auto',orNone- Y-coordinate of label relative to top end of left yaxis in multiples
of the height of a character (the current font size).
If list, use for each row of axes (estimated from their positions)
the corresponding offset.
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:stringorlistofstrings-
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 tompl.rcParams['figure.tags.label']. minor_label:string- If
axesis a nested list of axes, then for the inner listsminor_labelis 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. Seelabelsfor meaning of the formatting substrings. If None, set tompl.rcParams['figure.tags.minorlabel']. major_index:intorNone- Start labeling major axes with this index (0 = 'A').
If None, use last index from previous call to
tag(). minor_index:intorNone- 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
Noneare updated.Parameters
xoffs:floator'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:floator'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. Seetag()for details. minor_label:string- Label used to tag minor axes. Sets rcParam
figure.tags.minorlabel. Seetag()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()def uninstall_tag()def demo()-
Run a demonstration of the tag module.