Skip to content

Commit d8e37be

Browse files
committed
convert mappabledict to list of tuples
1 parent f3661f3 commit d8e37be

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/matplotlib/backends/qt_editor/figureoptions.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,16 @@ def prepare_data(d, init):
133133
has_curve = bool(curves)
134134

135135
# Get ScalarMappables.
136-
mappabledict = {}
136+
mappabledict = []
137137
for mappable in [*axes.images, *axes.collections]:
138138
label = mappable.get_label()
139139
if label == '_nolegend_' or mappable.get_array() is None:
140140
continue
141-
mappabledict[label] = mappable
141+
mappabledict.append((label, mappable))
142142
mappablelabels = sorted(mappabledict, key=cmp_key)
143143
mappables = []
144144
cmaps = [(cmap, name) for name, cmap in sorted(cm._cmap_registry.items())]
145-
for label in mappablelabels:
146-
mappable = mappabledict[label]
145+
for label, mappable in mappablelabels:
147146
cmap = mappable.get_cmap()
148147
if cmap not in cm._cmap_registry.values():
149148
cmaps = [(cmap, cmap.name), *cmaps]
@@ -224,7 +223,7 @@ def apply_callback(data):
224223

225224
# Set ScalarMappables.
226225
for index, mappable_settings in enumerate(mappables):
227-
mappable = mappabledict[mappablelabels[index]]
226+
mappable = mappabledict[index][1]
228227
if len(mappable_settings) == 5:
229228
label, cmap, low, high, interpolation = mappable_settings
230229
mappable.set_interpolation(interpolation)

0 commit comments

Comments
 (0)