Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upSave tool in gridplot initiates multiple downloads #8531
Comments
This comment has been minimized.
This comment has been minimized.
|
Unfortuntely, it's questionable whether it is feasible to do anything about this. Bokeh renders individual plots on separate HTML canvases, and that is not going to change. The built-in JavaScript APIs only support capturing individual canvases, which is why they all save separately, as you have experienced. The only other possible avenue I am aware of is html2canvas which can apparently render DOM arbitrary elements to a single canvas/image. However, Much more problematic, however, is it's size. It is 162kb minified. That would increase the size of BokehJS core (which is already on the "very large" spectrum of JS libraries) by another full 25 percent. It's simply not justifiable to unconditionally increase the payload by that amount for a single tool that is arguably only used by a relatively small number of users. So any solution would have to find a way to make the save tool behave more like a custom model, so that the payload cost is only paid by those who explicitly ask for it. In fact, I would say a good first step is for someone interested in this to create a custom extension that uses https://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html And, assuming that works out, we might then just decide that the best course is simply to document the custom extension for those that want to use it, rather than adding something directly in the library. |
bryevdv
added
the
type: discussion
label
Jan 1, 2019
This comment has been minimized.
This comment has been minimized.
|
If plots are canvases and subplots positions are available ( for (let canvas of canvases) {
data = canvas.getContext().getImageData(0, 0, canvas.width, canvas.height);
mergedCanvas.getContext().putImageData(data, xpos(canvas), ypos(canvas));
}
// Now download mergedCanvas |
This comment has been minimized.
This comment has been minimized.
|
In principle this could be done this way. One issue is to get grid plot's save tool to exec this code instead of proxying individual save tools. Currently there is no support for grid tools, only for proxied figures' tools. |
This comment has been minimized.
This comment has been minimized.
This really only affects "actions" so that circumscribes the problem somewhat. An offhand idea would be to allow |
This comment has been minimized.
This comment has been minimized.
tony-bony
commented
Feb 12, 2019
|
It is actually working (at least on Mac) using the export_png() method so I guess it's been already implemented in 1.0.4... See this post |
This comment has been minimized.
This comment has been minimized.
|
|
kernc commentedJan 1, 2019
ALL software version info (bokeh, python, notebook, OS, browser, any other relevant packages)
Bokeh 1.0.3
Python 3.5
Description of expected behavior and the observed behavior
Clicking 'save' tool on
gridplot()downloads each subplot separately. Preferably, if the tools are merged, so would the plots be merged into a single image.Complete, minimal, self-contained example code that reproduces the issue
Screenshots or screencasts of the bug in action