ShobiStassen / VIA

trajectory inference
https://pyvia.readthedocs.io/en/latest/
MIT License
76 stars 20 forks source link

plot_scatter() function problem #39

Closed barbareyex closed 1 year ago

barbareyex commented 1 year ago

Hi,

When calling the plot_scatter function that is supposed to be in the plotting_via module, it does not exist. The code:

import pyVIA.plotting_via plotting_via.plot_scatter(embedding = embedding, labels = v0.true_label) This last line reports: module 'pyVIA.plotting_via' has no attribute 'plot_scatter'

I thought it was a version problem, but I have installed the latest one. Another option is copying the definition of this function in plotting_via.py, but I would like to know why there's this problem.

Thanks!

ShobiStassen commented 1 year ago

Hi,

Have you tried import pyVIA.core as via via.plot_scatter(embedding =....)

Otherwise I'll have a look first thing in the morning!

ShobiStassen commented 1 year ago

@RRRReyes I tried a few different import calls and reinstalled pyVIA (0.1.77) and both these bits of code work for me:

    import umap
    import pyVIA.plotting_via as pv
    embedding = umap.UMAP(min_dist=0.5).fit_transform(adata_counts.obsm['X_pca'][:, 0:10])
    print('testing Via plot_scatter ')
    pv.plot_scatter(embedding=embedding, labels=true_label)

    print('testing Via plot_scatter ')
    import pyVIA.core as via
    via.plot_scatter(embedding=embedding, labels=true_label)
    plt.show()
Starlitnightly commented 1 year ago

Hi, @RRRReyes

I think you can use from pyVIA.plotting_via import plot_scatter to solve this issue.

barbareyex commented 1 year ago

Hi,

Have you tried import pyVIA.core as via via.plot_scatter(embedding =....)

Otherwise I'll have a look first thing in the morning!

Importing pyVIA.core as via instead of from pyVIA.core import *, and then calling the plot_scatter function as via.plot_scatter solved the problem.

Thank you so much!