[Bug]: resize_event deprecation warnings when creating figure on macOS with version 3.6.0 · Issue #23921 · matplotlib/matplotlib · GitHub
Skip to content

[Bug]: resize_event deprecation warnings when creating figure on macOS with version 3.6.0 #23921

Description

@alexander-held

Bug summary

Creating a figure via plt.figure() with matplotlib version 3.6.0 results in a MatplotlibDeprecationWarning. I see this on macOS (both M1 and Intel) and have not managed to reproduce this in a few other container environments I tried.

Code for reproduction

import matplotlib.pyplot as plt
plt.figure()

Actual outcome

/private/tmp/mpl/test.py:3: MatplotlibDeprecationWarning: The resize_event function was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use callbacks.process('resize_event', ResizeEvent(...)) instead.
  plt.figure()

Expected outcome

no warning raised

Additional information

I have not managed to reproduce this in any containers, so perhaps this is specific to the macosx backend. No warnings appear in earlier versions. I can reproduce the behavior also in new conda environments and virtual environments, here is a full example:

/tmp/mpl ❯ ls
/tmp/mpl ❯ pipx run virtualenv venv
created virtual environment CPython3.10.4.final.0-64 in 159ms
  creator CPython3Posix(dest=/private/tmp/mpl/venv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/alheld/Library/Application Support/virtualenv)
    added seed packages: pip==22.2.2, setuptools==65.3.0, wheel==0.37.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
/tmp/mpl ❯ source venv/bin/activate
/tmp/mpl ❯ python --version
Python 3.10.4
/tmp/mpl ❯ which python
/private/tmp/mpl/venv/bin/python
/tmp/mpl ❯ pip install matplotlib
Collecting matplotlib
  Using cached matplotlib-3.6.0-cp310-cp310-macosx_11_0_arm64.whl (7.2 MB)
Collecting pillow>=6.2.0
  Using cached Pillow-9.2.0-cp310-cp310-macosx_11_0_arm64.whl (2.8 MB)
Collecting numpy>=1.19
  Using cached numpy-1.23.3-cp310-cp310-macosx_11_0_arm64.whl (13.3 MB)
Collecting packaging>=20.0
  Using cached packaging-21.3-py3-none-any.whl (40 kB)
Collecting python-dateutil>=2.7
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting cycler>=0.10
  Using cached cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting fonttools>=4.22.0
  Using cached fonttools-4.37.2-py3-none-any.whl (959 kB)
Collecting contourpy>=1.0.1
  Using cached contourpy-1.0.5-cp310-cp310-macosx_11_0_arm64.whl (226 kB)
Collecting pyparsing>=2.2.1
  Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)
Collecting kiwisolver>=1.0.1
  Using cached kiwisolver-1.4.4-cp310-cp310-macosx_11_0_arm64.whl (63 kB)
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: six, pyparsing, pillow, numpy, kiwisolver, fonttools, cycler, python-dateutil, packaging, contourpy, matplotlib
Successfully installed contourpy-1.0.5 cycler-0.11.0 fonttools-4.37.2 kiwisolver-1.4.4 matplotlib-3.6.0 numpy-1.23.3 packaging-21.3 pillow-9.2.0 pyparsing-3.0.9 python-dateutil-2.8.2 six-1.16.0
/tmp/mpl ❯ python -c "import matplotlib.pyplot as plt; import matplotlib as mpl; print(mpl.__version__); plt.figure()"
3.6.0
<string>:1: MatplotlibDeprecationWarning: The resize_event function was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use callbacks.process('resize_event', ResizeEvent(...)) instead.

Operating system

macOS 12.5.1

Matplotlib Version

3.6.0

Matplotlib Backend

MacOSX

Python version

Python 3.10.4

Jupyter version

n/a

Installation

pip

Activity

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