aerosandbox.tools.pretty_plots.labellines.core
#
Module Contents#
Functions#
|
Label a single matplotlib line at position x |
|
Label all lines with their respective legends. |
Attributes#
- aerosandbox.tools.pretty_plots.labellines.core.labelLine(line, x, label=None, align=True, drop_label=False, yoffset=0, yoffset_logspace=False, outline_color='auto', outline_width=8, **kwargs)[source]#
Label a single matplotlib line at position x
- Parameters:
line (matplotlib.lines.Line) – The line holding the label
x (number) – The location in data unit of the label
label (string, optional) – The label to set. This is inferred from the line by default
drop_label (bool, optional) – If True, the label is consumed by the function so that subsequent calls to e.g. legend do not use it anymore.
yoffset (double, optional) – Space to add to label’s y position
yoffset_logspace (bool, optional) – If True, then yoffset will be added to the label’s y position in log10 space
outline_color (None | "auto" | color) – Colour of the outline. If set to “auto”, use the background color. If set to None, do not draw an outline.
outline_width (number) – Width of the outline
kwargs (dict, optional) – Optional arguments passed to ax.text
- aerosandbox.tools.pretty_plots.labellines.core.labelLines(lines, align=True, xvals=None, drop_label=False, shrink_factor=0.05, yoffsets=0, outline_color='auto', outline_width=5, **kwargs)[source]#
Label all lines with their respective legends.
- Parameters:
lines (list of matplotlib lines) – The lines to label
align (boolean, optional) – If True, the label will be aligned with the slope of the line at the location of the label. If False, they will be horizontal.
xvals ((xfirst, xlast) or array of float, optional) – The location of the labels. If a tuple, the labels will be evenly spaced between xfirst and xlast (in the axis units).
drop_label (bool, optional) – If True, the label is consumed by the function so that subsequent calls to e.g. legend do not use it anymore.
shrink_factor (double, optional) – Relative distance from the edges to place closest labels. Defaults to 0.05.
yoffsets (number or list, optional.) – Distance relative to the line when positioning the labels. If given a number, the same value is used for all lines.
outline_color (None | "auto" | color) – Colour of the outline. If set to “auto”, use the background color. If set to None, do not draw an outline.
outline_width (number) – Width of the outline
kwargs (dict, optional) – Optional arguments passed to ax.text