@@ -746,30 +746,31 @@ def sizeHint(self):
746746 return size
747747
748748 def edit_parameters (self ):
749- allaxes = self .canvas .figure .get_axes ()
750- if not allaxes :
749+ axes = self .canvas .figure .get_axes ()
750+ if not axes :
751751 QtWidgets .QMessageBox .warning (
752752 self .parent , "Error" , "There are no axes to edit." )
753753 return
754- elif len (allaxes ) == 1 :
755- axes , = allaxes
754+ elif len (axes ) == 1 :
755+ ax , = axes
756756 else :
757- titles = []
758- for axes in allaxes :
759- name = (axes .get_title () or
760- " - " .join (filter (None , [axes .get_xlabel (),
761- axes .get_ylabel ()])) or
762- "<anonymous {} (id: {:#x})>" .format (
763- type (axes ).__name__ , id (axes )))
764- titles .append (name )
757+ titles = [
758+ ax .get_label () or
759+ ax .get_title () or
760+ " - " .join (filter (None , [ax .get_xlabel (), ax .get_ylabel ()])) or
761+ f"<anonymous { type (ax ).__name__ } >"
762+ for ax in axes ]
763+ duplicate_titles = [
764+ title for title in titles if titles .count (title ) > 1 ]
765+ for i , ax in enumerate (axes ):
766+ if titles [i ] in duplicate_titles :
767+ titles [i ] += f" (id: { id (ax ):#x} )" # Deduplicate titles.
765768 item , ok = QtWidgets .QInputDialog .getItem (
766769 self .parent , 'Customize' , 'Select axes:' , titles , 0 , False )
767- if ok :
768- axes = allaxes [titles .index (item )]
769- else :
770+ if not ok :
770771 return
771-
772- figureoptions .figure_edit (axes , self )
772+ ax = axes [ titles . index ( item )]
773+ figureoptions .figure_edit (ax , self )
773774
774775 def _update_buttons_checked (self ):
775776 # sync button checkstates to match active mode
0 commit comments