Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No visualization after plot_diagram #691

Open
ghoshanirban opened this issue Mar 11, 2024 · 8 comments
Open

No visualization after plot_diagram #691

ghoshanirban opened this issue Mar 11, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@ghoshanirban
Copy link

ghoshanirban commented Mar 11, 2024

I am fiddling with the code provided at https://giotto-ai.github.io/gtda-docs/latest/notebooks/vietoris_rips_quickstart.html
The code runs fine, but I am not getting visualization output after

from gtda.plotting import plot_diagram

i = 0
plot_diagram(diagrams[i])

I have tried PyCharm and the terminal on Ubuntu 22.04. Is anyone else facing the same issue?

@beew
Copy link

beew commented Mar 19, 2024

Hi, I ran into the same issue when I ran the code in spyder (also Ubuntu 22.04). Turns out it works in Jupyter notebook. Looks like somehow the plotting method is written for notebook.

#661

@VascoSch92
Copy link

Looking at the code: the method is giving back a fig but it is not displaying it (this is what happens automatically on a notebook)

Try with

plot_diagram(diagrams[i]).show()

Or

print(plot_diagram(diagrams[i]))

@ghoshanirban
Copy link
Author

Looking at the code: the method is giving back a fig but it is not displaying it (this is what happens automatically on a notebook)

Try with

plot_diagram(diagrams[i]).show()

Or

print(plot_diagram(diagrams[i]))

Thank you; show() worked with PyCharm and the plot got opened in a browser window.
Matplotlib support would have been great.
Any ideas on how to use it in this case?

@VascoSch92
Copy link

The method name is really bad because it is not plotting but returning a plot, and then you have to plot it. I will suggest to rename that as get_diagram, generate_diagram, ....

Matplotlib support would have been great.
Any ideas on how to use it in this case?

What do you mean? Can you give some more details or an user-case? :-)

@ghoshanirban
Copy link
Author

I wondered if the plot can be exported to a pdf generated using Matplotlib.

@VascoSch92
Copy link

VascoSch92 commented Mar 21, 2024

Give a look here. :-)

And here there is the documentation on matplotlib.

@ghoshanirban
Copy link
Author

Thanks! I was expecting gudhi-like support:

gudhi.plot_persistence_barcode(barcodes)
plt.savefig("persistence-barcode.pdf", format="pdf", bbox_inches="tight")

Do we have this kind of support for giotto-tda?

@matteocao
Copy link
Contributor

@ghoshanirban we do not currently have the feature you mention: we would gladly accept a PR from you adding this if you are interested however!

@matteocao matteocao added the enhancement New feature or request label May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants