Hello,
I want to export datashader plots from Jupyter notebook into HTML using Jupyter's File->Export functionality. Firstly, i don't expect to have dynamic datashading, i know i need a Bokeh server for that. What i want is a static image rendered from a large number of data points, with all the benefits of aggregation and rasterization that datashader provides. However, when i do this the image that i get in the HTML file has a very low resolution. Is there any way to get this HTML static image to have a higher resolution?
Thank you.
When I do e.g. this:
e = datashade(hv.Scatter(np.random.randn(100000,2)), dynamic=False)
hv.save(e, 'test.html')
I get the same resolution in the static html that I would get in a live Python kernel. If you want a higher resolution, why use datashader? Or do you mean a smoother datashaded image?
The datashade and rasterize operations have a default height and width that is used for an initial call, and then in a live kernel they are immediately updated to match the screen resolution. A static export will use these initial values, and if you want higher resolution in them, just add specific height and width arguments to datashade or rasterize. You can also turn dynamic=False as @poplarShift suggests so that you'll get the same resolution in the live and exported versions, to let you check the results ahead of time. Note that you can supply much higher resolutions in this approach than would normally be useful, so that the exported version will allow zooming up to a point, which can often fully substitute for having a live Python server.
@jbednar @poplarShift Thanks, that's exactly what i was looking for. Closing this.
This would be really useful to have in the documentation!
A PR to achieve that would be very welcome!
Most helpful comment
The
datashadeandrasterizeoperations have a default height and width that is used for an initial call, and then in a live kernel they are immediately updated to match the screen resolution. A static export will use these initial values, and if you want higher resolution in them, just add specificheightandwidtharguments todatashadeorrasterize. You can also turndynamic=Falseas @poplarShift suggests so that you'll get the same resolution in the live and exported versions, to let you check the results ahead of time. Note that you can supply much higher resolutions in this approach than would normally be useful, so that the exported version will allow zooming up to a point, which can often fully substitute for having a live Python server.