lux icon indicating copy to clipboard operation
lux copied to clipboard

Plot to PDF (export)

Open Tobolder opened this issue 2 years ago • 5 comments

Hello,

first of all thanks for the great work! Going through the documentation/FAQ, I have not yet found a description how to export a selected plot to a per default high-res pdf file. I hope I didn't simply miss it, so here's the question: Would it be possible to implement such a feature in a way similar to "df.save_as_html()", e.g. "df.save_as_pdf(plot1, path)"?

I have seen you suggested right click on plot & save to png, but the resolution is an issue here. Also, for my plot example the "vis.to_matplotlib()"-way creates array-length incompatibilities, so a built-in pdf export would make things a lot easier.

Thanks for your support!! Tobi

Tobolder avatar Jul 22 '21 09:07 Tobolder

Hi @Tobolder, Thanks for your suggestions on exporting to PDF! As you mentioned the current approach is to right-click and save on individual plots. For exporting the PDF for the entire widget (all visualizations), you can print the page (Ctrl+P) and save as pdf. However, this will only show the visualization that is currently in the view.

Were you looking to save all the visualization outputs associated with the dataframe (i.e., the entire widget) as HTML, just a selected individual plot?

I'd love to understand how you would like the export the Lux visualizations to PDF. Feel free to book a time here so we can chat about how to we can make this work for your use case.

dorisjlee avatar Jul 23 '21 15:07 dorisjlee

Hi Doris,

thanks for your quick answer! I'm glad so see this project is so alive. :) Unfortunately I have some restrictions at my workplace and cannot book a time slot for a personal discussion. So I'll try to answer here:

What I tried is following https://lux-api.readthedocs.io/en/latest/source/guide/export.html : right click on desired image, add to data, then: vis = df.exported[0] df.save_as_html(r'C:\Users...\test.html')

but then again, I cannot zoom in or anything to increase the resolution and view the entire plot. So having an export feature similar to the ".save_as_html" command, but to pdf, just like Matplotlib's "plt.savefig('plot.pdf')", would be really handy! Maybe that could be integrated?

Tobolder avatar Jul 26 '21 06:07 Tobolder

Hi @Tobolder,

That sounds good, thanks for letting me know! We'd still appreciate it if you could drop us a note on how you are using Lux, this will really help us improve Lux in the future!

Regarding the export to PDF idea, for every tab of visualizations displayed in Lux has around 10~20 visualizations which are ranked from most to least interesting, which is why you have to scroll to see the ones that are farther down the list. Would you want all of these visualizations to be displayed in the PDF report as shown on the right? The order of the visualization would be left to right, top to bottom, as shown by the arrows. Would something like this be useful for you? Or are there other ways that you would like this PDF report to look?

Screen Shot 2021-07-26 at 4 46 21 PM

dorisjlee avatar Jul 26 '21 23:07 dorisjlee

Hi Doris,

it's great to see that you guys are so dedicated to this project. I can describe a bit: We usually have data sets in the form of pandas tables as a starting point and before decide what to investigate in detail, it is nice to have a quick look at the data. For this, lux is already great! In fact it is so useful, that the plots could directly be used for meetings - that's why I asked for the pdf version. :)

So your suggestion looks fine, if all plots are printed it is easy to find the one of particular interest. However, sometimes using the interactive window I make my way to the plot of interest using the "magnifying glass"-symbol. It would be great if the plot of interest could be marked for pdf export! But it any case, most important is to have a vector graphics plot which can then be implemented in a presentation, or a thesis or whatever, so that the resolution is not limiting the image quality anymore. :)

Tobolder avatar Jul 27 '21 06:07 Tobolder

Thanks for your detailed explanation @Tobolder!

Your suggestions make a lot of sense. I will look into how we can better support these exports either for the entire widget based on the dataframe or some selected set of visualizations of interest.

dorisjlee avatar Aug 01 '21 16:08 dorisjlee