@@ -102,6 +102,7 @@ class method for conveniently constructing DotPlot from tidy data
102
102
data_frame = data_frame [keys ]
103
103
_original_item_order = data_frame [item_key ].tolist ()
104
104
_original_item_order = _original_item_order [::- 1 ]
105
+ _original_item_order = sorted (set (_original_item_order ), key = _original_item_order .index )
105
106
if sizes_func is not None :
106
107
data_frame [sizes_key ] = data_frame [sizes_key ].map (sizes_func )
107
108
if color_func is not None :
@@ -204,7 +205,7 @@ def __draw_legend(ax, sct: mpl.collections.PathCollection, size_factor, title, c
204
205
def __preprocess_data (self , size_factor , cluster_row = False , cluster_col = False , ** kwargs ):
205
206
206
207
method = kwargs .get ('cluster_method' , 'ward' )
207
- metric = kwargs .get ('cluster_metric' , 'eulidean ' )
208
+ metric = kwargs .get ('cluster_metric' , 'euclidean ' )
208
209
n_clusters = kwargs .get ('cluster_n' , None )
209
210
210
211
if cluster_row or cluster_col :
@@ -215,15 +216,15 @@ def __preprocess_data(self, size_factor, cluster_row=False, cluster_col=False, *
215
216
else :
216
217
_index = cluster_hierarchy (self .size_data , axis = 1 , method = method ,
217
218
metric = metric , n_clusters = n_clusters )
218
- for item in self .__slots__ :
219
- if hasattr ( self , item ):
220
- obj_attr = getattr ( self , item )
221
- if isinstance (obj_attr , pd .DataFrame ):
219
+ obj_data = self .__dict__ . copy ()
220
+ for _obj_attr , _obj in obj_data . items ( ):
221
+ if not _obj_attr . startswith ( '__' ):
222
+ if isinstance (_obj , pd .DataFrame ):
222
223
if cluster_row :
223
- obj_attr = obj_attr .loc [_index , :]
224
+ _obj = _obj .loc [_index , :]
224
225
if cluster_col :
225
- obj_attr = obj_attr .loc [:, _index ]
226
- setattr (self , item , obj_attr )
226
+ _obj = _obj .loc [:, _index ]
227
+ setattr (self , _obj_attr , _obj )
227
228
self .resized_size_data = self .size_data .applymap (func = lambda x : x * size_factor )
228
229
if self .circle_data is not None :
229
230
self .resized_circle_data = self .circle_data .applymap (func = lambda x : x * size_factor )
0 commit comments