@@ -146,12 +146,27 @@ def prepare_data(d, init):
146
146
continue
147
147
labeled_mappables .append ((label , mappable ))
148
148
mappables = []
149
- cmaps = [(cmap , name ) for name , cmap in sorted (cm ._colormaps .items ())]
150
149
for label , mappable in labeled_mappables :
151
150
cmap = mappable .get_cmap ()
152
- if cmap not in cm ._colormaps .values ():
151
+ if isinstance (cmap , mcolors .Colormap ):
152
+ cmaps = [(cmap , name ) for name , cmap in sorted (cm ._colormaps .items ())]
153
+ cvals = cm ._colormaps .values ()
154
+ elif isinstance (cmap , mcolors .BivarColormap ):
155
+ cmaps = [(cmap , name ) for name , cmap in sorted (cm ._bivar_colormaps .items ())]
156
+ cvals = cm ._bivar_colormaps .values ()
157
+ else : # isinstance(mappable.get_cmap(), mcolors.MultivarColormap):
158
+ cmaps = [(cmap , name ) for name , cmap
159
+ in sorted (cm ._multivar_colormaps .items ())]
160
+ cvals = cm ._multivar_colormaps .values ()
161
+ if cmap not in cvals :
153
162
cmaps = [(cmap , cmap .name ), * cmaps ]
154
- low , high = mappable .get_clim ()
163
+ low , high = mappable .nac .get_clim ()
164
+ if len (low ) == 1 :
165
+ low = low [0 ]
166
+ high = high [0 ]
167
+ else :
168
+ low = str (low )[1 :- 1 ]
169
+ high = str (high )[1 :- 1 ]
155
170
mappabledata = [
156
171
('Label' , label ),
157
172
('Colormap' , [cmap .name ] + cmaps ),
@@ -242,6 +257,9 @@ def apply_callback(data):
242
257
label , cmap , low , high = mappable_settings
243
258
mappable .set_label (label )
244
259
mappable .set_cmap (cmap )
260
+ if isinstance (low , str ):
261
+ low = [float (l ) for l in low .split (',' )]
262
+ high = [float (l ) for l in high .split (',' )]
245
263
mappable .set_clim (* sorted ([low , high ]))
246
264
247
265
# re-generate legend, if checkbox is checked
@@ -263,7 +281,6 @@ def apply_callback(data):
263
281
if getattr (axes , f"get_{ name } lim" )() != orig_limits [name ]:
264
282
figure .canvas .toolbar .push_current ()
265
283
break
266
-
267
284
_formlayout .fedit (
268
285
datalist , title = "Figure options" , parent = parent ,
269
286
icon = QtGui .QIcon (
0 commit comments