Plotly.js: feature request: when downloading plot as png using the modebar button, use the current size of the plot as the size of the png

Created on 10 Apr 2017  路  6Comments  路  Source: plotly/plotly.js

Currently it does not use the size of the plot as it has been rendered into the browser. The data ranges and such are all the same, but since the size is different the legend may overlap parts that it did not when viewed in the browser and the aspect ratio may be different.

bug

Most helpful comment

https://github.com/plotly/plotly.js/pull/3746 add a JSON-serializable way to do effectively what is presented in https://github.com/plotly/plotly.js/issues/1576#issuecomment-293043413


Next, as @antoinerg points out in https://github.com/plotly/plotly.js/pull/3746#issuecomment-481012418, maybe we could:

Could config options toImageButtonOptions: {width: null, height: null} be the default when responsive: true?

in v2, or better yet make {width: null, height: null} the default behavior in v2 when Plotly.toImage is called with an existing graph div as first argument.

All 6 comments

Unfortunately, that's more like a backward-incompatible change than a feature request. If we do choose to do this, we'll have to wait for v2.

In the meantime, here's a workaround: http://codepen.io/etpinard/pen/NpvYOo

Thanks for the feedback and adding my own options to that code snippet worked well :)

Is there any progress on this feature?- It kinda seems important to be able to save your plots as an png :)

Bump

@etpinard would this really be a "breaking" change? In what scenarios would this not be a net improvement over the current arbitrary dimensions of the downloaded PNG when no width/height are set?

https://github.com/plotly/plotly.js/pull/3746 add a JSON-serializable way to do effectively what is presented in https://github.com/plotly/plotly.js/issues/1576#issuecomment-293043413


Next, as @antoinerg points out in https://github.com/plotly/plotly.js/pull/3746#issuecomment-481012418, maybe we could:

Could config options toImageButtonOptions: {width: null, height: null} be the default when responsive: true?

in v2, or better yet make {width: null, height: null} the default behavior in v2 when Plotly.toImage is called with an existing graph div as first argument.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maxwell8888 picture maxwell8888  路  3Comments

tim-sauchuk picture tim-sauchuk  路  3Comments

hashimmoosavi picture hashimmoosavi  路  3Comments

emanuelsetitinger picture emanuelsetitinger  路  3Comments

jonmmease picture jonmmease  路  3Comments