Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bca7620

Browse filesBrowse files
committed
fix imagewidget vmin vmax bug
1 parent 36c25fe commit bca7620
Copy full SHA for bca7620

File tree

1 file changed

+10
-6
lines changed
Filter options

1 file changed

+10
-6
lines changed

‎fastplotlib/widgets/image.py

Copy file name to clipboardExpand all lines: fastplotlib/widgets/image.py
+10-6Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from typing import *
88
from warnings import warn
99
from functools import partial
10+
from copy import deepcopy
1011

1112

1213
DEFAULT_DIMS_ORDER = \
@@ -493,11 +494,11 @@ def __init__(
493494
self._plot: GridPlot = GridPlot(shape=grid_shape, controllers="sync")
494495

495496
self.image_graphics = list()
496-
for i, (d, subplot) in enumerate(zip(self.data, self.plot)):
497-
minmax = quick_min_max(self.data[0])
497+
for data_ix, (d, subplot) in enumerate(zip(self.data, self.plot)):
498+
minmax = quick_min_max(self.data[data_ix])
498499

499500
if self._names is not None:
500-
name = self._names[i]
501+
name = self._names[data_ix]
501502
name_slider = name
502503
else:
503504
name = None
@@ -518,17 +519,20 @@ def __init__(
518519
)
519520

520521
minmax_slider.observe(
521-
partial(self._vmin_vmax_slider_changed, i),
522+
partial(self._vmin_vmax_slider_changed, data_ix),
522523
names="value"
523524
)
524525

525526
self.vmin_vmax_sliders.append(minmax_slider)
526527

527528
if ("vmin" not in kwargs.keys()) or ("vmax" not in kwargs.keys()):
528-
kwargs["vmin"], kwargs["vmax"] = minmax
529+
_kwargs = deepcopy(kwargs)
530+
_kwargs["vmin"], _kwargs["vmax"] = minmax
531+
else:
532+
_kwargs = kwargs
529533

530534
frame = self._process_indices(d, slice_indices=self._current_index)
531-
ig = ImageGraphic(frame, **kwargs)
535+
ig = ImageGraphic(frame, **_kwargs)
532536
subplot.add_graphic(ig)
533537
subplot.name = name
534538
self.image_graphics.append(ig)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.