ipympl icon indicating copy to clipboard operation
ipympl copied to clipboard

Download figure as pdf, not as png.

Open srosenzweig09 opened this issue 4 years ago • 6 comments

Describe the issue

Widgets are displayed with a toolbar, which has a save/download button that saves the figure directly to my Downloads folder. I love this feature, but I would appreciate it even more if I can set it to download the image as a pdf instead of as a png. Is this a possibility?

srosenzweig09 avatar Aug 17 '21 15:08 srosenzweig09

I believe this is not on the roadmap for ipympl, but maybe someone has another opinion, do you have any input on this @ianhi?

I guess this would be difficult to implement unless we find a JavaScript library that makes this easy.

martinRenou avatar Aug 17 '21 15:08 martinRenou

https://github.com/MrRio/jsPDF

martinRenou avatar Aug 17 '21 15:08 martinRenou

This is the same underlying issue as https://github.com/matplotlib/ipympl/issues/138 and https://github.com/matplotlib/ipympl/issues/234 which is the savefig button doesn't respect rcparams because it doesn't follow the normal savefig path.

Ultimately I think ipympl should respect that from buttons. I think the way to have that happen is to have a bit more back and forth between front and backend when the save button is pushed. So it could like what I sketched out in https://github.com/matplotlib/ipympl/issues/138#issuecomment-663699886

ianhi avatar Aug 17 '21 16:08 ianhi

For pdf we need the option 1 i proposed which is just using the javascript to choose the filepath and then doing everything on hte backend

ianhi avatar Aug 17 '21 16:08 ianhi