Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 64619e5 commit b5701e1Copy full SHA for b5701e1
1 file changed
lib/matplotlib/legend.py
@@ -360,7 +360,7 @@ def __init__(
360
"""
361
# local import only to avoid circularity
362
from matplotlib.axes import Axes
363
- from matplotlib.figure import Figure
+ from matplotlib.figure import FigureBase
364
365
super().__init__()
366
@@ -434,11 +434,13 @@ def __init__(
434
self.isaxes = True
435
self.axes = parent
436
self.set_figure(parent.figure)
437
- elif isinstance(parent, Figure):
+ elif isinstance(parent, FigureBase):
438
self.isaxes = False
439
self.set_figure(parent)
440
else:
441
- raise TypeError("Legend needs either Axes or Figure as parent")
+ raise TypeError(
442
+ "Legend needs either Axes or FigureBase as parent"
443
+ )
444
self.parent = parent
445
446
self._loc_used_default = loc is None
0 commit comments