atompy.add_abc#

atompy.add_abc(fig=None, xoffset_pts=2.0, yoffset_pts=-12.0, anchor='top left', labels='a b c d e f g h i j k l m n o p q r s t u v w x y z', pre='(', post=')', start_at=0, rowsfirst=True, **text_kwargs)[source]#

Add labels to all suplots in fig.

By default, adds ‘(a)’, ‘(b)’, … to each subplot in the upper-right corner.

Parameters:
figmatplotlib.figure.Figure, optional

If None, use last active figure.

xoffset_ptsfloat, default: 2.0

Offset in pts from anchor. Positive moves right.

yoffset_ptsfloat, default: -12.0

Offset in pts from anchor. Positive moves up.

anchor{"top left", "top right", "bottom left", "bottom right"}

Specify anchor point of the labels (offsets are relative to this). Refers to the corner of the graph-area of the axes.

labelsstr, optional

A string of labels, where each label is seperated by a space.

If None, use label of the respective axes (i.e., ax.get_label()).

prestr, default: "("

String in front of labels. Applies only if labels is not None.

poststr, default: ")"

String after labels. Applies only if labels is not None.

start_atint, default: 0

Skip start_at entries in labels. Only applies if labels is not None.

rowsfirstbool, default: True

Label rows first, e.g., “a b c / d e f” instead of “a c e / b d f”. Only applies if labels is not None.

text_kwargs

Additional keyword arguments of matplotlib.text.Text. For a list thereof, see here.

Returns:
text_dictdict[matplotlib.axes.Axes, matplotlib.text.Text]

A dictionary with the axes of fig as keys and the corresponding text instances added by add_abc as values.

Can be used to manipulate the text later (to, e.g., change the color of the text only for certain subplots).

Notes

  • Cannot handle a fancy matplotlib.gridspec.GridSpec, e.g., where one subplot spans multiple other subplots. If you need one of those, you’re on your own.

  • make_me_nice() does not see the added labels. If your labels extent further than the current axes dimensions, they will be cut of when calling .make_me_nice. To alleviate the problem, apply additional margins in make_me_nice.