Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/matplotlib/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ def add_label_near(self, x, y, inline=True, inline_spacing=5,
label_width = self._get_nth_label_width(level)
rotation, path = self._split_path_and_get_label_rotation(
path, idx_vtx_min, proj, label_width, inline_spacing)
self.add_label(*proj, rotation, self.labelLevelList[idx_level_min],
self.labelCValueList[idx_level_min])
self.add_label(*proj, rotation, self.labelLevelList[level],
self.labelCValueList[level])

if inline:
self._paths[idx_level_min] = path
Expand Down
7 changes: 7 additions & 0 deletions lib/matplotlib/tests/test_contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,3 +891,10 @@ def test_contour_aliases(fig_test, fig_ref):
def test_contour_singular_color():
with pytest.raises(TypeError):
plt.figure().add_subplot().contour([[0, 1], [2, 3]], color="r")


def test_clabel_manual_subset():
fig, ax = plt.subplots()
cs = ax.contour([[1, 2], [3, 4]], levels=[1.5, 2.5, 3.5])
# Attempt to label only one specific level manually
ax.clabel(cs, levels=[2.5], manual=[(0.5, 0.5)])
Loading