8000 [Bug]: False positive legend handler warnings in 3.6.0.rc1 · Issue #23761 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
[Bug]: False positive legend handler warnings in 3.6.0.rc1 #23761
Closed
@mwaskom

Description

@mwaskom

Bug summary

With the 3.6.0.rc1, matplotlib is issuing warnings when preparing a legend if the axes contains artists that do not have a registered legend handler even if the artist was not provided with a label.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt

f, ax = plt.subplots()
ax.pcolormesh(np.random.uniform(0, 1, (10, 10)))
ax.get_legend_handles_labels()

Actual outcome

Warning:

/var/folders/pk/kq0vw6sj3ssd914z55j1qmzc0000gn/T/ipykernel_68178/1573363929.py:6: UserWarning: Legend does not support handles for QuadMesh instances.
See: https://matplotlib.org/stable/tutorials/intermediate/legend_guide.html#implementing-a-custom-legend-handler
  ax.get_legend_handles_labels()

Expected outcome

This was not previously so noisy.

Additional information

I skimmed the existing issues and didn't see anything obviously reporting this, but haven't tried against main so apologies if this is a dupe.

Matplotlib Version

3.6.0.rc1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0