@@ -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