You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Snapshot routines should allow users to specify image width/height #83
changed the title [-]Snapshot routines should allow uses to specify image width/height[/-][+]Snapshot routines should allow users to specify image width/height[/+]on Dec 7, 2015
Is there a way to get raw PNG data from a plot snapshot? We would like to do this so that we can generate a PNG output in an IPython notebook so that when viewing the .ipynb file in Github or elsewhere where Javascript is not executed there is a static fallback version that gets displayed.
(and we need to do this in the Javascript code, not Python)
I think that for the user it would be really interesting to be able to choose the image size. But also it could be too much features on the plot and reduce simplicity...
I would suggest that the coder who is buiding the plot could choose if the users (the ones who will be watching the plot) are capable to change or not the PNG image from the plot.
To do so I would suggest to add inside the layout variable an option which involves the modebar, and where it could be such a variable like "snapshotsize" which could admit a vector including a fixed size: snapshotsize = [1000 1000] or either the auto option snapshotsize = "auto"
Regarding the "auto" functionality I would suggest that a dialog box appears on the plot allowing to choose the dimension of it. Somehow similar to the message box which appears when you click the snapshot button and it tells you that Taking snapshot - this may take a few seconds
With this implementation the current way that snapshots are being done right now can be kept (as the coder can decide the output size) but also the new feature of being able to choose the plot size can be implemented.
For what it is worth, in PlotlyJS.jl I can get true vector image pdf/eps/svg export as well as configurable png/jpeg exporting by getting the svg data from plotly, using librsvg to load that into cairo, and using cairo to render to the desired file type.
Yes, I just started working through this. Here is the very preliminary set of thoughts. By the end of the week, I hope to have a full plan to address this. Is that ok?
Activity
[-]Snapshot routines should allow uses to specify image width/height[/-][+]Snapshot routines should allow users to specify image width/height[/+]sglyon commentedon Jan 26, 2016
Ping, any update on this?
etpinard commentedon Jan 26, 2016
We're still doing experiments with potential APIs. No serious work has gone into this to date.
That said, once we figure out how to expose things to the users, this should be a 2-day project.
etpinard commentedon Jan 27, 2016
Once we're comfortable with the API, we should expose the
toImageon thePlotlydirectly.Moreover, we'll need
toImageto return a promise, like the otherPlotlyasync methods.gramster commentedon Feb 4, 2016
Is there a way to get raw PNG data from a plot snapshot? We would like to do this so that we can generate a PNG output in an IPython notebook so that when viewing the .ipynb file in Github or elsewhere where Javascript is not executed there is a static fallback version that gets displayed.
(and we need to do this in the Javascript code, not Python)
sglyon commentedon Feb 4, 2016
You should be able to do
Plotly.Snapshot.toImage(gd, {"format": "png"}), which will return a promise you then have to deal with resolving.gramster commentedon Feb 5, 2016
Thanks. I don't see docs on Plotly promises. I tried this:
but I get:
toImage()is returning an EventEmitter.What am I missing?
gramster commentedon Feb 5, 2016
Ah, I see. I need to use
...toImage(...).once('success', function(url) { ...})ifll commentedon Feb 11, 2016
I think that for the user it would be really interesting to be able to choose the image size. But also it could be too much features on the plot and reduce simplicity...
I would suggest that the coder who is buiding the plot could choose if the users (the ones who will be watching the plot) are capable to change or not the PNG image from the plot.
To do so I would suggest to add inside the layout variable an option which involves the modebar, and where it could be such a variable like "snapshotsize" which could admit a vector including a fixed size:
snapshotsize = [1000 1000]or either the auto optionsnapshotsize = "auto"Regarding the
"auto"functionality I would suggest that a dialog box appears on the plot allowing to choose the dimension of it. Somehow similar to the message box which appears when you click the snapshot button and it tells you thatTaking snapshot - this may take a few secondsWith this implementation the current way that snapshots are being done right now can be kept (as the coder can decide the output size) but also the new feature of being able to choose the plot size can be implemented.
etpinard commentedon Feb 24, 2016
Unfortunately other obligations came up for the plotly.js team members and this issue will remain on hold until at least April 1.
Our apologies.
jackparmer commentedon Apr 7, 2016
Related discussion: http://community.plot.ly/t/use-plotly-offline-to-save-chart-as-image-file/408/8
sglyon commentedon Apr 7, 2016
For what it is worth, in PlotlyJS.jl I can get true vector image pdf/eps/svg export as well as configurable png/jpeg exporting by getting the svg data from plotly, using librsvg to load that into cairo, and using cairo to render to the desired file type.
etpinard commentedon Apr 7, 2016
@timelyportfolio have you made any progress on this one?
timelyportfolio commentedon Apr 7, 2016
Yes, I just started working through this. Here is the very preliminary set of thoughts. By the end of the week, I hope to have a full plan to address this. Is that ok?
timelyportfolio commentedon Apr 8, 2016
timelyportfolio#1 (comment) is my first attempt, and it seems we now have both 2) promises and 3) resize. I would appreciate any thoughts.
etpinard commentedon May 16, 2016
done in #446