BiomedicalMachineLearning/stLearn

question for st.pl.cluster_plot fuction

Closed this issue · 2 comments

Dear developer,
Thanks for your wonderful jobs!
I got an error wtih the trying of "st.pl.cluster_plot" and "spatila trajectory" fuction. Before this, I apply stSME spatial-PCA option using the following code:
st.spatial.morphology.adjust(data,use_data="X_pca",radius=50,method="mean")
st.pp.neighbors(data,n_neighbors=25,use_rep='X_pca_morphology',random_state=0)
st.tl.clustering.louvain(data,random_state=0).
It works and get 9 clusters to plot. But I want more clusters for detail trajectory. So I modified the resolution:
st.spatial.morphology.adjust(data,use_data="X_pca",radius=50,method="mean")
st.pp.neighbors(data,n_neighbors=25,use_rep='X_pca_morphology',random_state=0)
st.tl.clustering.louvain(data, resolution=1.2,random_state=0).
At the resolution 1.2, I got more clusters but failed to plot. It reminds: the color of clusters list index out of range.

Thanks for your attention.

It failed to change the new color array. We will try to fix it.
You can delete the color array before the st.tl.clustering.louvain (every time you run this) by:

del data.uns['louvain_colors']

or you you can use scanpy to plot

sc.pl.spatial(data, color='louvain')