MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / clabel

Method clabel

lib/matplotlib/contour.py:62–231  ·  view source on GitHub ↗

Label a contour plot. Adds labels to line contours in this `.ContourSet` (which inherits from this mixin class). Parameters ---------- levels : array-like, optional A list of level values, that should be labeled. The list must be

(self, levels=None, *,
               fontsize=None, inline=True, inline_spacing=5, fmt=None,
               colors=None, use_clabeltext=False, manual=False,
               rightside_up=True, zorder=None)

Source from the content-addressed store, hash-verified

60 """Mixin to provide labelling capability to `.ContourSet`."""
61
62 def clabel(self, levels=None, *,
63 fontsize=None, inline=True, inline_spacing=5, fmt=None,
64 colors=None, use_clabeltext=False, manual=False,
65 rightside_up=True, zorder=None):
66 """
67 Label a contour plot.
68
69 Adds labels to line contours in this `.ContourSet` (which inherits from
70 this mixin class).
71
72 Parameters
73 ----------
74 levels : array-like, optional
75 A list of level values, that should be labeled. The list must be
76 a subset of ``cs.levels``. If not given, all levels are labeled.
77
78 fontsize : str or float, default: :rc:`font.size`
79 Size in points or relative size e.g., 'small', 'x-large'.
80 See `.Text.set_size` for accepted string values.
81
82 colors : :mpltype:`color` or colors or None, default: None
83 The label colors:
84
85 - If *None*, the color of each label matches the color of
86 the corresponding contour.
87
88 - If one string color, e.g., *colors* = 'r' or *colors* =
89 'red', all labels will be plotted in this color.
90
91 - If a tuple of colors (string, float, RGB, etc), different labels
92 will be plotted in different colors in the order specified.
93
94 inline : bool, default: True
95 If ``True`` the underlying contour is removed where the label is
96 placed.
97
98 inline_spacing : float, default: 5
99 Space in pixels to leave on each side of label when placing inline.
100
101 This spacing will be exact for labels at locations where the
102 contour is straight, less so for labels on curved contours.
103
104 fmt : `.Formatter` or str or callable or dict, optional
105 How the levels are formatted:
106
107 - If a `.Formatter`, it is used to format all levels at once, using
108 its `.Formatter.format_ticks` method.
109 - If a str, it is interpreted as a %-style format string.
110 - If a callable, it is called with one level at a time and should
111 return the corresponding label.
112 - If a dict, it should directly map levels to labels.
113
114 The default is to use a standard `.ScalarFormatter`.
115
116 manual : bool or iterable, default: False
117 If ``True``, contour labels will be placed manually using
118 mouse clicks. Click the first button near a contour to
119 add a label, click the second button (or potentially both

Callers

nothing calls this directly

Calls 5

add_label_nearMethod · 0.95
labelsMethod · 0.95
create_dummy_axisMethod · 0.80
get_zorderMethod · 0.80
get_figureMethod · 0.45

Tested by

no test coverage detected