Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
Changelog
=========

2.1.0
3.0.1
-----
Bug fixes
~~~~~~~~~
- Fix an error that happened when changing the contrast limit when the histogram widget was open

3.0.0
-----
New features
~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion src/napari_matplotlib/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def _update_contrast_lims(self) -> None:
for lim, line in zip(
self.layers[0].contrast_limits, self._contrast_lines, strict=False
):
line.set_xdata(lim)
line.set_xdata([lim])

self.figure.canvas.draw()

Expand Down
12 changes: 12 additions & 0 deletions src/napari_matplotlib/tests/test_histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,15 @@ def test_change_layer(make_napari_viewer, brain_data, astronaut_data):
viewer.layers.selection.clear()
viewer.layers.selection.add(viewer.layers[1])
assert_figures_not_equal(widget.figure, fig1)


def test_change_contrast(make_napari_viewer, astronaut_data):
viewer = make_napari_viewer()
viewer.add_image(astronaut_data[0], **astronaut_data[1])

widget = HistogramWidget(viewer)
viewer.window.add_dock_widget(widget)

# update contrast limits of image layer, and check no errors are thrown
image_layer = viewer.layers[0]
image_layer.contrast_limits = [2, 50]
Loading