FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Contours are not removed correctly when using clabel with manual · Issue #9988 · matplotlib/matplotlib · GitHub

Repository navigation

Contours are not removed correctly when using clabel with manual #9988

Closed

Description

Bug report

Bug summary

Contours created using pyplot.contour are not correctly removed when labelling the contours usingplt.clabel invoked with inline=True and manual positions.

Code for reproduction

import numpy as np
from matplotlib import pyplot as plt

x = np.linspace(-1, 1)
xx, yy = np.meshgrid(x, x)

fig, axes = plt.subplots(1, 2, True, True)

manual = None
for ax in axes:
    cs = ax.contour(x, x, xx ** 2 + yy ** 2)
    clabels = plt.clabel(cs, manual=manual)
    manual = [label.get_position() for label in clabels]

Expected outcome on the left, actual outcome on the right

Matplotlib version

  • Operating system: Linux 273ceb986a84 4.9.49-moby Fix autofmt_xdate() when using in conjunction with twinx() #1 SMP Wed Sep 27 23:17:17 UTC 2017 x86_64 GNU/Linux
  • Matplotlib version: 2.1.1
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.6.3
  • Jupyter version (if applicable): 4.4.0
  • Other libraries: numpy (1.13.3)

All libraries were installed using pip in a docker image derived from python:3.

Activity

  1. jklymak commented on Dec 12, 2017

    Member

    Thanks for the nice test. Interestingly its backend dependent: MacOS is OK, though different than the outplacement; Qt5Agg is worse than what you show above. I'd try Qt5Cairo, but its not merged yet :-(

  2. added this to the milestone on Dec 12, 2017
  3. tillahoffmann commented on Dec 12, 2017

    ContributorAuthor

    Interesting. I'm ultimately interested in rendering to PDF. Do you think using the MacOS backend first and then using fig.savefig('/path/to.pdf') could do the trick?

  4. jklymak commented on Dec 12, 2017

    Member

    Oddly that does seem to do the trick. But.... This is still a bug.

  5. jklymak commented on Dec 12, 2017

    Member

    ... a mercifully one-line bug... See #9989

  6. jklymak commented on Dec 12, 2017

    Member

  7. tillahoffmann commented on Dec 12, 2017

    ContributorAuthor

    🎉 that was speedy! Thank you!

  8. modified the milestones: , v2.2.0 on Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL