Skip to content

"Download plot as png" returns damaged heatmaps, if it is a lot of values #1446

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

Closed
PlatonB opened this issue Mar 4, 2019 · 6 comments
Closed

Comments

@PlatonB
Copy link

PlatonB commented Mar 4, 2019

Plotly 3.6.1, Fedora 28, Firefox 65.

A screenshot of a big heatmap made by "Download plot as png" is incorrect:
plotly_ld_triangle_big_heatmap

The correct version made by Firefox Screenshots:
firefox_ld_triangle_big_heatmap

@jonmmease
Copy link
Contributor

jonmmease commented Mar 4, 2019

Hi @PlatonB, thanks for the report.

Could you share the code you're using to make this? Or better yet, a minimal example with synthetic data that shows the problem.

We'll need to work out a reproducible example and open a report with the Plotly.js project at https://github.com/plotly/plotly.js/issues

@PlatonB
Copy link
Author

PlatonB commented Mar 4, 2019

Hello, @jonmmease !
Example with synthetic data:

import random, plotly as py, plotly.figure_factory as ff
z = [[round(random.random(), 2) for cell_index in range(300)] for row_index in range(300)]
heatmap = ff.create_annotated_heatmap(z, xgap=1, ygap=1, colorscale='Greens')
heatmap['layout']['annotations'] = []
py.offline.plot(heatmap)

"Download plot as a png":
plotly_random_300x300

Firefox Screenshots:
firefox_random_300x300

@jonmmease jonmmease removed the question label Mar 4, 2019
@jonmmease
Copy link
Contributor

Hi @PlatonB,

I think the issue might be the figure size. Clicking save snapshot doesn't automatically use the current figure size. So my guess is that the figure is expanded to a larger size when you take the firefox snapshot than the default plotly download png size. Try setting the figure.layout.width and figure.layout.height to something larger and see if you get better results.

Alternatively, you might consider setting xgap and ygap to 0 when the resolution of the heatmap is approaching the resolution of the plot area of the resulting png image.

@PlatonB
Copy link
Author

PlatonB commented Mar 7, 2019

Hello, @jonmmease !
I made width x height equal 1920x1080, and set xgap and ygap as 0. Indeed it works that way. The heatmap saved as png is visible (albeit slightly blurred). It's a bit frustrating that this is not the default behavior.

@jonmmease
Copy link
Contributor

For discussion of figure size when using the export button see plotly/plotly.js#1576.

It alright if we close this here in favor of that issue?

@PlatonB
Copy link
Author

PlatonB commented Mar 8, 2019

Thanks!
OK.

@PlatonB PlatonB closed this as completed Mar 8, 2019
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

No branches or pull requests

2 participants