File tree Expand file tree Collapse file tree 4 files changed +26
-4
lines changed Expand file tree Collapse file tree 4 files changed +26
-4
lines changed Original file line number Diff line number Diff line change 1010 - main
1111 tags :
1212 - " v*" # Push events to matching v*, i.e. v1.0, v20.15.10
13+ workflow_dispatch :
1314
1415jobs :
1516 build-docs :
Original file line number Diff line number Diff line change 77 - id : trailing-whitespace
88
99 - repo : https://github.com/psf/black
10- rev : 23.11.0
10+ rev : 23.12.1
1111 hooks :
1212 - id : black
1313
@@ -17,14 +17,14 @@ repos:
1717 - id : napari-plugin-checks
1818
1919 - repo : https://github.com/pre-commit/mirrors-mypy
20- rev : v1.7.1
20+ rev : v1.8.0
2121 hooks :
2222 - id : mypy
2323 additional_dependencies : [numpy, matplotlib]
2424
2525 - repo : https://github.com/astral-sh/ruff-pre-commit
2626 # Ruff version.
27- rev : ' v0.1.6 '
27+ rev : ' v0.1.11 '
2828 hooks :
2929 - id : ruff
3030
Original file line number Diff line number Diff line change 11[metadata]
2- name = napari_matplotlib
2+ name = napari-matplotlib
33description = A plugin to use Matplotlib with napari
44long_description = file: README.md
55long_description_content_type = text/markdown
Original file line number Diff line number Diff line change @@ -30,6 +30,23 @@ def __init__(
3030 ):
3131 super ().__init__ (napari_viewer , parent = parent )
3232 self ._update_layers (None )
33+ self .viewer .events .theme .connect (self ._on_napari_theme_changed )
34+
35+ def on_update_layers (self ) -> None :
36+ """
37+ Called when the selected layers are updated.
38+ """
39+ super ().on_update_layers ()
40+ for layer in self .viewer .layers :
41+ layer .events .contrast_limits .connect (self ._update_contrast_lims )
42+
43+ def _update_contrast_lims (self ) -> None :
44+ for lim , line in zip (
45+ self .layers [0 ].contrast_limits , self ._contrast_lines
46+ ):
47+ line .set_xdata (lim )
48+
49+ self .figure .canvas .draw ()
3350
3451 def draw (self ) -> None :
3552 """
@@ -63,6 +80,10 @@ def draw(self) -> None:
6380 else :
6481 self .axes .hist (data .ravel (), bins = bins , label = layer .name )
6582
83+ self ._contrast_lines = [
84+ self .axes .axvline (lim , color = "white" )
85+ for lim in layer .contrast_limits
86+ ]
6687 self .axes .legend ()
6788
6889
You can’t perform that action at this time.
0 commit comments