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

Skip to content

Commit 0bdc8f6

Browse files
committed
Merge pull request #4840 from anntzer/edit-noaxes
ENH: Improve error when trying to edit empty figure.
2 parents 92f2328 + 1a66b6a commit 0bdc8f6

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)