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

ENH Download plots as PDF in the html (for now only SVG) #777

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Jad-yehya
Copy link
Contributor

Trying to add the functionality described in issue #767

Added a PDF button in the html to download the plot in pdf. For now it is only possible to download the plot as an SVG.
I added the exportPDF function that utilizes Plotly directly by calling the downloadImage method.

Next step would be to convert the svg to pdf directly in the exportPDF. An attempt has been unsuccesful using jsPDF.

Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.27%. Comparing base (104e413) to head (b35cd10).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #777   +/-   ##
=======================================
  Coverage   82.27%   82.27%           
=======================================
  Files          46       46           
  Lines        3171     3171           
=======================================
  Hits         2609     2609           
  Misses        562      562           

Copy link
Member

@tomMoral tomMoral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you show a screen shot of the interface ?


Plotly.downloadImage(plot,
{format: 'svg',
// filename is the name of the solver used
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not the solver?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes not the solver, but the objective, the metric and the chart type.

Here is the screenshot of the page
Capture d’écran 2024-11-29 à 09 17 23

And this is the svg result
Non Negative Least Squares fit_intercept=False _Simulated n_features=10000,n_samples=100,positive=True _objective_value_objective_curve

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it a svg? it shoud be a pdf :) or change the name of the feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is an svg because I couldn't convert it yet to pdf like I said in my first comment. It is still a work in progress.

@Jad-yehya Jad-yehya changed the title ENH Download plots as PDF in the html ENH Download plots as PDF in the html (for now only SVG) Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants