1313
1414
1515class ScatterBaseWidget (NapariMPLWidget ):
16+ """
17+ Base class for widgets that scatter two datasets against each other.
18+ """
19+
1620 # opacity value for the markers
1721 _marker_alpha = 0.5
1822
@@ -90,7 +94,8 @@ class ScatterWidget(ScatterBaseWidget):
9094 input_layer_types = (napari .layers .Image ,)
9195
9296 def _get_data (self ) -> Tuple [List [np .ndarray ], str , str ]:
93- """Get the plot data.
97+ """
98+ Get the plot data.
9499
95100 Returns
96101 -------
@@ -109,6 +114,10 @@ def _get_data(self) -> Tuple[List[np.ndarray], str, str]:
109114
110115
111116class FeaturesScatterWidget (ScatterBaseWidget ):
117+ """
118+ Widget to scatter data stored in two layer feature attributes.
119+ """
120+
112121 n_layers_input = Interval (1 , 1 )
113122 # All layers that have a .features attributes
114123 input_layer_types = (
@@ -132,7 +141,9 @@ def __init__(self, napari_viewer: napari.viewer.Viewer):
132141
133142 @property
134143 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+ """
136147 return self ._x_axis_key
137148
138149 @x_axis_key .setter
@@ -142,16 +153,23 @@ def x_axis_key(self, key: Optional[str]) -> None:
142153
143154 @property
144155 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+ """
146159 return self ._y_axis_key
147160
148161 @y_axis_key .setter
149162 def y_axis_key (self , key : Optional [str ]) -> None :
163+ """
164+ Set the y-axis key.
165+ """
150166 self ._y_axis_key = key
151167 self ._draw ()
152168
153169 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+ """
155173 self ._x_axis_key = x_axis_key
156174 self ._y_axis_key = y_axis_key
157175 self ._draw ()
@@ -174,7 +192,8 @@ def _get_valid_axis_keys(
174192 return self .layers [0 ].features .keys ()
175193
176194 def _get_data (self ) -> Tuple [List [np .ndarray ], str , str ]:
177- """Get the plot data.
195+ """
196+ Get the plot data.
178197
179198 Returns
180199 -------
@@ -213,8 +232,7 @@ def _get_data(self) -> Tuple[List[np.ndarray], str, str]:
213232
214233 def _on_update_layers (self ) -> None :
215234 """
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()``.
218236 """
219237 if hasattr (self , "_key_selection_widget" ):
220238 self ._key_selection_widget .reset_choices ()
0 commit comments