File tree 4 files changed +26
-4
lines changed
4 files changed +26
-4
lines changed Original file line number Diff line number Diff line change 10
10
- main
11
11
tags :
12
12
- " v*" # Push events to matching v*, i.e. v1.0, v20.15.10
13
+ workflow_dispatch :
13
14
14
15
jobs :
15
16
build-docs :
Original file line number Diff line number Diff line change 7
7
- id : trailing-whitespace
8
8
9
9
- repo : https://github.com/psf/black
10
- rev : 23.11.0
10
+ rev : 23.12.1
11
11
hooks :
12
12
- id : black
13
13
@@ -17,14 +17,14 @@ repos:
17
17
- id : napari-plugin-checks
18
18
19
19
- repo : https://github.com/pre-commit/mirrors-mypy
20
- rev : v1.7.1
20
+ rev : v1.8.0
21
21
hooks :
22
22
- id : mypy
23
23
additional_dependencies : [numpy, matplotlib]
24
24
25
25
- repo : https://github.com/astral-sh/ruff-pre-commit
26
26
# Ruff version.
27
- rev : ' v0.1.6 '
27
+ rev : ' v0.1.11 '
28
28
hooks :
29
29
- id : ruff
30
30
Original file line number Diff line number Diff line change 1
1
[metadata]
2
- name = napari_matplotlib
2
+ name = napari-matplotlib
3
3
description = A plugin to use Matplotlib with napari
4
4
long_description = file: README.md
5
5
long_description_content_type = text/markdown
Original file line number Diff line number Diff line change @@ -30,6 +30,23 @@ def __init__(
30
30
):
31
31
super ().__init__ (napari_viewer , parent = parent )
32
32
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 ()
33
50
34
51
def draw (self ) -> None :
35
52
"""
@@ -63,6 +80,10 @@ def draw(self) -> None:
63
80
else :
64
81
self .axes .hist (data .ravel (), bins = bins , label = layer .name )
65
82
83
+ self ._contrast_lines = [
84
+ self .axes .axvline (lim , color = "white" )
85
+ for lim in layer .contrast_limits
86
+ ]
66
87
self .axes .legend ()
67
88
68
89
You can’t perform that action at this time.
0 commit comments