Skip to content

legend.get_window_extent() fails #21285

Closed
@durack1

Description

@durack1

Bug summary

It seems a bug has crept in with points_to_pixels not available as a function called by get_window_extent

Code for reproduction

(Pdb) leg2 = plt.legend(loc='upper left', ncol=2, fontsize=8)
(Pdb) leg2.get_window_extent()
*** AttributeError: 'NoneType' object has no attribute 'points_to_pixels'
(Pdb) print(matplotlib.__version__)
3.4.2
(Pdb) print(matplotlib.get_backend())
MacOSX
(Pdb) import sys; print(sys.version_info)
sys.version_info(major=3, minor=9, micro=6, releaselevel='final', serial=0)
$ jupyter --version
jupyter core     : 4.7.1
jupyter-notebook : 6.4.0
qtconsole        : 5.1.1
ipython          : 7.25.0
ipykernel        : 6.0.1
jupyter client   : 6.1.12
jupyter lab      : not installed
nbconvert        : 6.1.0
ipywidgets       : 7.6.3
nbformat         : 5.1.3
traitlets        : 5.0.5

Actual outcome

Error, as above

Expected outcome

I expected to get coords

Operating system

MacOS 11.6

Matplotlib Version

3.4.2

Matplotlib Backend

MacOSX

Python version

3.9.6

Jupyter version

core 4.7.1; notebook 6.4.0

Other libraries

No response

Installation

conda

Conda channel

conda-forge

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions