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

Skip to content

Commit e34f7ee

Browse files
authored
Merge pull request #15171 from dstansby/3dslider
MNT: Add useful error message when trying to add Slider to 3DAxes
2 parents e67c2fb + 440a46e commit e34f7ee

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/matplotlib/widgets.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,9 @@ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
320320
knob. See the :class:`~matplotlib.patches.Rectangle` documentation for
321321
valid property names (e.g., `facecolor`, `edgecolor`, `alpha`).
322322
"""
323+
if ax.name == '3d':
324+
raise ValueError('Sliders cannot be added to 3D Axes')
325+
323326
AxesWidget.__init__(self, ax)
324327

325328
if slidermin is not None and not hasattr(slidermin, 'val'):

0 commit comments

Comments
 (0)