clabel(self, levels=None, *, fontsize=None, inline=True, inline_spacing=5, fmt=None, colors=None, use_clabeltext=False, manual=False, rightside_up=True, zorder=None)
Adds labels to line contours in this .ContourSet
(which inherits from this mixin class).
A list of level values, that should be labeled. The list must be a subset of cs.levels
. If not given, all levels are labeled.
Size in points or relative size e.g., 'smaller', 'x-large'. See :None:None:`.Text.set_size`
for accepted string values.
The label colors:
If None, the color of each label matches the color of the corresponding contour.
If one string color, e.g., colors = 'r' or colors = 'red', all labels will be plotted in this color.
If a tuple of colors (string, float, rgb, etc), different labels will be plotted in different colors in the order specified.
If True
the underlying contour is removed where the label is placed.
Space in pixels to leave on each side of label when placing inline.
This spacing will be exact for labels at locations where the contour is straight, less so for labels on curved contours.
How the levels are formatted:
If a .Formatter
, it is used to format all levels at once, using its .Formatter.format_ticks
method.
If a str, it is interpreted as a %-style format string.
If a callable, it is called with one level at a time and should return the corresponding label.
If a dict, it should directly map levels to labels.
The default is to use a standard .ScalarFormatter
.
If True
, contour labels will be placed manually using mouse clicks. Click the first button near a contour to add a label, click the second button (or potentially both mouse buttons at once) to finish adding labels. The third button can be used to remove the last label added, but only if labels are not inline. Alternatively, the keyboard can be used to select label locations (enter to end label placement, delete or backspace act like the third mouse button, and any other key will select a label location).
manual can also be an iterable object of (x, y) tuples. Contour labels will be created as if mouse is clicked at each (x, y) position.
If True
, label rotations will always be plus or minus 90 degrees from level.
If True
, .ClabelText
class (instead of :None:None:`.Text`
) is used to create labels. ClabelText
recalculates rotation angles of texts during the drawing time, therefore this can be used if aspect of the axes changes.
zorder of the contour labels.
A list of :None:None:`.Text`
instances for the labels.
Label a contour plot.
The following pages refer to to this document either explicitly or contain code examples using this.
matplotlib.pyplot.clabel
matplotlib.axes._axes.Axes.clabel
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them