STOmics / Stereopy

A toolkit of spatial transcriptomic analysis.
MIT License
187 stars 64 forks source link

How to set plotting functions basic formatting arguments? #124

Closed vdet closed 1 year ago

vdet commented 1 year ago

Hello, I am no python expert. How to set basic formatting arguments in stereopy plotting functions? For example, the range of the y-axis in violin() (i.e. equivalent of the range arguments in matplotlib.pyplot.hist), or the lower/upper limits of the colors scale in spatial_scatter()? Etc.

In addition, is there a way to disable the 'Exporting the plot.' interface?

tanliwei-coder commented 1 year ago

Hi! Sorry,currently, the plotting functions can not support the arguments you mentioned beause it is not positioned as a common plotting module, and also, the 'Exporting the plot.' can not be disabled.

vdet commented 1 year ago

Thanks, meanwhile a work around is to create a new variable. Building on the cell bin tutorial, https://stereopy.readthedocs.io/en/latest/Tutorials/CellBin_Clustering.html :

max_count = 1200
truncated_row_sum = data.exp_matrix.sum(axis=1)
truncated_row_sum[row_sum > max_count] = max_count
data.cells.truncated_row_sum = truncated_row_sum
data.plt.spatial_scatter(cells_key=['truncated_row_sum'])

All the best,