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

Skip to content

Commit 1a66b6a

Browse files
committed
Improve error when trying to edit empty figure.
Compare bringing up the axes editor (the green tick button) on a figure with no axes before and after the patch.
1 parent 92f2328 commit 1a66b6a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,10 @@ def _init_toolbar(self):
610610
if figureoptions is not None:
611611
def edit_parameters(self):
612612
allaxes = self.canvas.figure.get_axes()
613+
if not allaxes:
614+
QtWidgets.QMessageBox.warning(
615+
self.parent, "Error", "There are no axes to edit.")
616+
return
613617
if len(allaxes) == 1:
614618
axes = allaxes[0]
615619
else:

0 commit comments

Comments
 (0)