8000 Nicer axes names in selector for figure options. · matplotlib/matplotlib@710cb7f · GitHub
[go: up one dir, main page]

Skip to content

Commit 710cb7f

Browse files
committed
Nicer axes names in selector for figure options.
Replace the old label, which included the legthy repr of the axes object, to a nicer label which emphasizes the title or axes labels (depending on what is present). Also drops the use of the label of the Axes object itself, for which I haven't found any other reference or use in general. (Another option would be to use solely `Axes.get_label()` when defined, as this doesn't seem to have any other use.) See #5468.
1 parent a56d588 commit 710cb7f

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -619,22 +619,16 @@ def edit_parameters(self):
619619
titles = []
620620
for axes in allaxes:
621621
title = axes.get_title()
622+
xlabel = axes.get_xlabel()
622623
ylabel = axes.get_ylabel()
623-
label = axes.get_label()
624624
if title:
625-
fmt = "%(title)s"
626-
if ylabel:
627-
fmt += ": %(ylabel)s"
628-
fmt += " (%(axes_repr)s)"
629-
elif ylabel:
630-
fmt = "%(axes_repr)s (%(ylabel)s)"
631-
elif label:
632-
fmt = "%(axes_repr)s (%(label)s)"
625+
name = title
626+
elif xlabel and ylabel:
627+
name = "{} - {}".format(xlabel, ylabel)
633628
else:
634-
fmt = "%(axes_repr)s"
635-
titles.append(fmt % dict(title=title,
636-
ylabel=ylabel, label=label,
637-
axes_repr=repr(axes)))
629+
name = "<anonymous {} (id: {:#x})>".format(
630+
type(axes).__name__, id(axes))
631+
titles.append(name)
638632
item, ok = QtWidgets.QInputDialog.getItem(
639633
self.parent, 'Customize', 'Select axes:', titles, 0, False)
640634
if ok:

0 commit comments

Comments
 (0)
0