Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Bug]: ContourLabeler.clabel with manual != False breaks unconnected contours #27062

Copy link
Copy link
Closed
@rho-novatron

Description

@rho-novatron
Issue body actions

Bug summary

When adding contour label positions manually (either via clicking or specifying an iterable of positions), contours with disconnected parts are not handled correctly, but sometimes rejoined seemingly arbitrarily.

Code for reproduction

import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots()
x, y = np.mgrid[-1:1:21j, -1:1:21j]

cs = ax.contour(x, y, 1/np.sqrt(0.01+(x+0.3)**2+y**2) + 1/np.sqrt(0.01+(x-0.3)**2+y**2), levels=[7])
cs.clabel(manual=[(0.2, 0.1)])

Actual outcome

image

Expected outcome

As it looked in matplotlib 3.7.3:
image

Additional information

No response

Operating system

No response

Matplotlib Version

3.8.0

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

conda

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.