Topics

Saving images created with d.plot

Xavier Flores
 

Greetings,

I would like to know if there is a quick way to save the plots generated by the plot_diagram and plot_bars. I know they use matplotlib, and I have tried to modify the file plot.py in the dionysus module to include the savefig feature, but I have not been successful. Any ideas?

Thanks for the help and keep up the amazing work,

Kind regards,

Xavi

Dmitriy Morozov
 

Hi Xavi,

Calling savefig() should just work, you only need to remove show=True from the example. So to tweak the example on the plotting page:

d.plot.plot_diagram(dgms[1])
import matplotlib.pyplot as plt
plt.savefig('myfig.pdf') 

Let me know if it works.
Dmitriy


On Mon, Oct 29, 2018 at 7:09 PM <xavier.flores@...> wrote:

Greetings,

I would like to know if there is a quick way to save the plots generated by the plot_diagram and plot_bars. I know they use matplotlib, and I have tried to modify the file plot.py in the dionysus module to include the savefig feature, but I have not been successful. Any ideas?

Thanks for the help and keep up the amazing work,

Kind regards,

Xavi

Xavier Flores
 

Dear Dmitriy,


It works perfectly on dionysus 2 on Ubuntu 16.04.


Thank you very much for your quick answer.


Regards,


Xavi


De: dionysus@groups.io <dionysus@groups.io> en nombre de Dmitriy Morozov <dmitriy@...>
Enviado: martes, 30 de octubre de 2018 11:11:02
Para: dionysus@groups.io
Asunto: Re: [dionysus] Saving images created with d.plot
 
Hi Xavi,

Calling savefig() should just work, you only need to remove show=True from the example. So to tweak the example on the plotting page:

d.plot.plot_diagram(dgms[1])
import matplotlib.pyplot as plt
plt.savefig('myfig.pdf') 

Let me know if it works.
Dmitriy

On Mon, Oct 29, 2018 at 7:09 PM <xavier.flores@...> wrote:

Greetings,

I would like to know if there is a quick way to save the plots generated by the plot_diagram and plot_bars. I know they use matplotlib, and I have tried to modify the file plot.py in the dionysus module to include the savefig feature, but I have not been successful. Any ideas?

Thanks for the help and keep up the amazing work,

Kind regards,

Xavi