scallops.visualize.utils.multicolor_labels
- scallops.visualize.utils.multicolor_labels(ax, list_of_labels, list_of_colors, axis='x', anchorpad=0, **kwargs)
Create axes labels with multiple colors.
- Parameters:
ax (Axes) – matplotlib.axes.Axes The axes object where the labels should be drawn.
list_of_labels (Sequence[str]) – list A list of all text items.
list_of_colors (Sequence[str]) – list A corresponding list of colors for the strings.
axis (Literal['x', 'y', 'both']) – {‘x’, ‘y’, ‘both’}, optional Specifies which label(s) should be drawn.
anchorpad (float) – float, optional Padding between the label and the axis.
kwargs (dict) – dict, optional Additional keyword arguments passed to textprops.
- Example:
import matplotlib.pyplot as plt from scallops.visualize.utils import multicolor_labels fig, ax = plt.subplots() strings = ["Label 1", "Label 2", "Label 3"] colors = ["red", "green", "blue"] multicolor_labels(ax, strings, colors, axis="y") plt.show()
- Return type:
None