13
13
14
14
15
15
class ScatterBaseWidget (NapariMPLWidget ):
16
+ """
17
+ Base class for widgets that scatter two datasets against each other.
18
+ """
19
+
16
20
# opacity value for the markers
17
21
_marker_alpha = 0.5
18
22
@@ -90,7 +94,8 @@ class ScatterWidget(ScatterBaseWidget):
90
94
input_layer_types = (napari .layers .Image ,)
91
95
92
96
def _get_data (self ) -> Tuple [List [np .ndarray ], str , str ]:
93
- """Get the plot data.
97
+ """
98
+ Get the plot data.
94
99
95
100
Returns
96
101
-------
@@ -109,6 +114,10 @@ def _get_data(self) -> Tuple[List[np.ndarray], str, str]:
109
114
110
115
111
116
class FeaturesScatterWidget (ScatterBaseWidget ):
117
+ """
118
+ Widget to scatter data stored in two layer feature attributes.
119
+ """
120
+
112
121
n_layers_input = Interval (1 , 1 )
113
122
# All layers that have a .features attributes
114
123
input_layer_types = (
@@ -132,7 +141,9 @@ def __init__(self, napari_viewer: napari.viewer.Viewer):
132
141
133
142
@property
134
143
def x_axis_key (self ) -> Optional [str ]:
135
- """Key to access x axis data from the FeaturesTable"""
144
+ """
145
+ Key to access x axis data from the FeaturesTable.
146
+ """
136
147
return self ._x_axis_key
137
148
138
149
@x_axis_key .setter
@@ -142,16 +153,23 @@ def x_axis_key(self, key: Optional[str]) -> None:
142
153
143
154
@property
144
155
def y_axis_key (self ) -> Optional [str ]:
145
- """Key to access y axis data from the FeaturesTable"""
156
+ """
157
+ Key to access y axis data from the FeaturesTable.
158
+ """
146
159
return self ._y_axis_key
147
160
148
161
@y_axis_key .setter
149
162
def y_axis_key (self , key : Optional [str ]) -> None :
163
+ """
164
+ Set the y-axis key.
165
+ """
150
166
self ._y_axis_key = key
151
167
self ._draw ()
152
168
153
169
def _set_axis_keys (self , x_axis_key : str , y_axis_key : str ) -> None :
154
- """Set both axis keys and then redraw the plot"""
170
+ """
171
+ Set both axis keys and then redraw the plot.
172
+ """
155
173
self ._x_axis_key = x_axis_key
156
174
self ._y_axis_key = y_axis_key
157
175
self ._draw ()
@@ -174,7 +192,8 @@ def _get_valid_axis_keys(
174
192
return self .layers [0 ].features .keys ()
175
193
176
194
def _get_data (self ) -> Tuple [List [np .ndarray ], str , str ]:
177
- """Get the plot data.
195
+ """
196
+ Get the plot data.
178
197
179
198
Returns
180
199
-------
@@ -213,8 +232,7 @@ def _get_data(self) -> Tuple[List[np.ndarray], str, str]:
213
232
214
233
def _on_update_layers (self ) -> None :
215
234
"""
216
- This is called when the layer selection changes by
217
- ``self.update_layers()``.
235
+ Called when the layer selection changes by ``self.update_layers()``.
218
236
"""
219
237
if hasattr (self , "_key_selection_widget" ):
220
238
self ._key_selection_widget .reset_choices ()
0 commit comments