-
Notifications
You must be signed in to change notification settings - Fork 69
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
Save chart to image #43
Comments
Would love to see this too! |
Upvote |
We would be interested to offer a backend for Xploit for static charts. |
I want it too. Need this feature to use in chatbot |
essential feature for me |
HighCharts makes use of a public server for rasterisation, but I haven't seen any similar service for Plotly. With kaleido image generation is lighter weight than Orca, but needs to be hosted as a service for this to work nicely. |
Plotly does have an API for saving charts as an image type, so it's just a matter of writing the API wire-up code to do that with a sensible default. Also worth noting that if you use XPlot as it exists today in a notebook, there is a button to just download the chart as an image already. |
Ah fantastic i wasn't aware, would be a nice addition. I'll try to take a look if nobody beats me to it 👍 |
If we are in Javascript land then we can certainly call something like Plotly.toImage() but this requires adding to the JS stub and the plot actually being displayed in the browser. However, the main benefit of saving to a static image (as far as I can imagine) would be to facilitate the generation of images without first having to display the image. For example, a frequent use-case for me personally when using Plotly from python is to use write_image within a loop to generate potentially hundreds of PNG's for later comparison, or even animation. What is being proposed here (and please correct me if I'm wrong @ArtemyB @thomasd3 @cartermp) is to first require displaying the chart in the browser and then subsequently invoking the JS API to do the rasterisation, and would not facilitate the use case I described above. Not to say this is not nonetheless useful, but I would really like to understand the exact use case before embarking on an actual implementation! |
Personally, I need rasterization on the server. To send an image using a chatbot. |
@malisimo the way this would get done to fit in with how XPlot works is just to build up the JS call programmatically via an F# API that would likely allow for different image types, since plotly supports PNG, SVG, and JPG.
I think it might require a slightly different stub, I guess it depends on what the ideal way to use the plotly API is. But fundamentally this would just be about adding the stub and wiring up an F# API to it to take a trace and produce a plot that gets saved as an image. Ultimately since Plotly (and thus XPlot.Plotly) is about charting in the browser (or some hosted browser I suppose) this will just follow what it's meant for. Server-size image processing might be out of scope. |
I've published a package for |
that's is great! thanks for doing this! |
Oh, I made a mistake. I had 2 tabs with XPlot and Plotly.NET issues and selected the wrong one :) However the approach for XPlot.Plotly is the same. Looks like only a small fix of HTML patching is needed. I'm sorry for this unwise situation :) |
Would be nice to have capability of saving charts to images from code. For example, this will allow to create a couple of FsLab formatters as static image (could be especially useful for implementing LaTeX XPlot formatters). And it's no wonder that this feature is already supported by original libraries:
P.S.: Thanks so much for this library!
The text was updated successfully, but these errors were encountered: