|
5 | 5 |
|
6 | 6 | """Module that provides a GUI-based editor for Matplotlib's figure options."""
|
7 | 7 |
|
8 |
| -import re |
9 |
| - |
10 | 8 | from matplotlib import cbook, cm, colors as mcolors, markers, image as mimage
|
11 | 9 | from matplotlib.backends.qt_compat import QtGui
|
12 | 10 | from matplotlib.backends.qt_editor import _formlayout
|
@@ -65,18 +63,6 @@ def convert_limits(lim, converter):
|
65 | 63 | xunits = axes.xaxis.get_units()
|
66 | 64 | yunits = axes.yaxis.get_units()
|
67 | 65 |
|
68 |
| - # Sorting for default labels (_lineXXX, _imageXXX). |
69 |
| - def cmp_key(label): |
70 |
| - """ |
71 |
| - Label should be a tuple consisting of the string label, |
72 |
| - and the object being sorted by label. |
73 |
| - """ |
74 |
| - match = re.match(r"(_line|_image)(\d+)", label[0]) |
75 |
| - if match: |
76 |
| - return match.group(1), int(match.group(2)) |
77 |
| - else: |
78 |
| - return label[0], 0 |
79 |
| - |
80 | 66 | # Get / Curves
|
81 | 67 | labeled_lines = []
|
82 | 68 | for line in axes.get_lines():
|
@@ -113,7 +99,7 @@ def prepare_data(d, init):
|
113 | 99 | sorted(short2name.items(),
|
114 | 100 | key=lambda short_and_name: short_and_name[1]))
|
115 | 101 |
|
116 |
| - for label, line in sorted(labeled_lines, key=cmp_key): |
| 102 | + for label, line in labeled_lines: |
117 | 103 | color = mcolors.to_hex(
|
118 | 104 | mcolors.to_rgba(line.get_color(), line.get_alpha()),
|
119 | 105 | keep_alpha=True)
|
@@ -150,7 +136,7 @@ def prepare_data(d, init):
|
150 | 136 | labeled_mappables.append((label, mappable))
|
151 | 137 | mappables = []
|
152 | 138 | cmaps = [(cmap, name) for name, cmap in sorted(cm._cmap_registry.items())]
|
153 |
| - for label, mappable in sorted(labeled_mappables, key=cmp_key): |
| 139 | + for label, mappable in labeled_mappables: |
154 | 140 | cmap = mappable.get_cmap()
|
155 | 141 | if cmap not in cm._cmap_registry.values():
|
156 | 142 | cmaps = [(cmap, cmap.name), *cmaps]
|
|
0 commit comments