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