Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: Quiver not working with subfigure? #22804

@henry2004y

Description

@henry2004y

Bug summary

There seems to be an issue when trying to plot quivers in the axes created within subfigures.

Code for reproduction

import matplotlib.pyplot as plt
fig = plt.figure()
subfigs = fig.subfigures(1, 2)
axsLeft = subfigs[0].subplots(1, 2)
axsLeft[0].quiver(1,1,1,1)

Actual outcome

Traceback (most recent call last):
File "", line 1, in
File "/home/hyzhou/.local/lib/python3.8/site-packages/matplotlib/init.py", line 1361, in inner
return func(ax, *map(sanitize_sequence, args), **kwargs)
File "/home/hyzhou/.local/lib/python3.8/site-packages/matplotlib/axes/_axes.py", line 5117, in quiver
q = mquiver.Quiver(self, *args, **kw)
File "/home/hyzhou/.local/lib/python3.8/site-packages/matplotlib/quiver.py", line 510, in init
self._cid = ax.figure.callbacks.connect('dpi_changed', on_dpi_change)
AttributeError: 'SubFigure' object has no attribute 'callbacks'

Expected outcome

Expect the same outcome as

fig, ax = plt.subplots(1, 2,)
ax[0].quiver(1,1,1,1)

Additional information

No response

Operating system

Ubuntu

Matplotlib Version

3.4.3

Matplotlib Backend

No response

Python version

3.8.5

Jupyter version

No response

Installation

No response

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