Skip to content

Commit ff0012e

Browse files
committed
Merge pull request #6347 from anntzer/image-options-clims
ENH: Allow setting image clims in Qt options editor.
2 parents 3b8c094 + 2f28508 commit ff0012e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/matplotlib/backends/qt_editor/figureoptions.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,12 @@ def prepare_data(d, init):
139139
cmap = image.get_cmap()
140140
if cmap not in cm.cmap_d.values():
141141
cmaps = [(cmap, cmap.name)] + cmaps
142+
low, high = image.get_clim()
142143
imagedata = [
143144
('Label', label),
144-
('Colormap', [cmap.name] + cmaps)
145-
]
145+
('Colormap', [cmap.name] + cmaps),
146+
('Min. value', low),
147+
('Max. value', high)]
146148
images.append([imagedata, label, ""])
147149
# Is there an image displayed?
148150
has_image = bool(images)
@@ -199,9 +201,10 @@ def apply_callback(data):
199201
# Set / Images
200202
for index, image_settings in enumerate(images):
201203
image = imagedict[imagelabels[index]]
202-
label, cmap = image_settings
204+
label, cmap, low, high = image_settings
203205
image.set_label(label)
204206
image.set_cmap(cm.get_cmap(cmap))
207+
image.set_clim(*sorted([low, high]))
205208

206209
# re-generate legend, if checkbox is checked
207210
if generate_legend:

0 commit comments

Comments
 (0)