bokeh
bokeh copied to clipboard
[FEATURE] Emit warning when data too large to render as image
Problem description
Currently, if trying to plot an image from an array that is beyond a certain size, Bokeh will just display an empty plot. This can be confusing.
Feature description
Consider emitting a warning when dataset is too large to plot.
Potential alternatives
None
Additional information
from bokeh.plotting import figure, show
from bokeh.io import output_notebook
from bokeh.layouts import row
import numpy as np
output_notebook()
data1 = np.random.rand(2, 60000)
data2 = np.random.rand(2, 70000)
data3 = np.random.rand(1, 70000)
p1 = figure(width=300, height=150)
p2 = figure(width=300, height=150)
p3 = figure(width=300, height=150)
p1.image(image=[data1], x=0, y=0, dw=2, dh=60000)
p2.image(image=[data2], x=0, y=0, dw=2, dh=70000)
p3.image(image=[data3], x=0, y=0, dw=1, dh=70000)
show(row(p1, p2, p3))
Consider emitting a warning when dataset is too large to plot.
Do you mean in Python? How could we know ahead of time? I expect this limitation is depends on browser version, OS, and possibly other issues. E.g. all of the above render fine on Safari for me:
Are there any console errors in your browser? I expect JS console message is the best we can do here.
ah, interesting. I didn't expect that. It works in Safari for me as well but not Chrome. I don't see any errors in the Chrome console. I think a message there would be sufficient.
It really depends on the browser and its config. Additionally browsers can either reach these limits silently like Chromium does or fail hard like Firefox does, e.g.:
and at a much lower threshold than Chromium.
I will mark this as a discussion for the time being, but I strongly doubt we can do anything in general here.
sounds good. thanks for investigating! Maybe a note in the documentation would be a sufficient step for the short term.