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:
- fig
matplotlib.figure.Figure, optional If None, use last active figure.
- xoffset_pts
float, default:2.0 Offset in pts from anchor. Positive moves right.
- yoffset_pts
float, 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.
- labels
str, 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()).- pre
str, default:"(" String in front of labels. Applies only if labels is not
None.- post
str, default:")" String after labels. Applies only if labels is not
None.- start_at
int, 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.
- fig
- Returns:
- text_dict
dict[matplotlib.axes.Axes,matplotlib.text.Text] A dictionary with the axes of fig as keys and the corresponding text instances added by
add_abcas values.Can be used to manipulate the text later (to, e.g., change the color of the text only for certain subplots).
- text_dict
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 inmake_me_nice.