giotto-tda
giotto-tda copied to clipboard
No visualization after plot_diagram
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?
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.
https://github.com/giotto-ai/giotto-tda/issues/661
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]))
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?
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? :-)
I wondered if the plot can be exported to a pdf generated using Matplotlib.
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?
@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!