publiplots.set_axis_labels#
- publiplots.set_axis_labels(ax, xlabel=None, ylabel=None, title=None, fontsize=None, fontweight=None)[source]#
Set axis labels and title with consistent formatting.
Only labels that are explicitly provided are set;
Nonevalues leave the existing label / title untouched.- Parameters:
ax (matplotlib.axes.Axes) – Axes to modify in place.
xlabel (str, optional) – X-axis label.
Noneleaves it unchanged.ylabel (str, optional) – Y-axis label.
Noneleaves it unchanged.title (str, optional) – Plot title.
Noneleaves it unchanged.fontsize (float, optional) – Font size (points) for labels and title.
Noneomits the kwarg entirely, so labels keepaxes.labelsizeand the title keepsaxes.titlesize.fontweight (str, optional) – Font weight — e.g.
'normal','bold','light'.Noneomits the kwarg entirely, so labels keepaxes.labelweightand the title keepsaxes.titleweight.
Notes
Each font kwarg is omitted when not supplied rather than forwarded as
None: matplotlib’sset_fontsize(None)/set_fontweight(None)reset the text to the genericfont.size/font.weight, which would discard the per-role rcParam already applied at creation.Examples
>>> pp.set_axis_labels(ax, xlabel='Time (s)', ylabel='Signal', ... title='Results')