Skip to content
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

[FEATURE] Emit warning when data too large to render as image #13645

Open
droumis opened this issue Jan 9, 2024 · 5 comments
Open

[FEATURE] Emit warning when data too large to render as image #13645

droumis opened this issue Jan 9, 2024 · 5 comments

Comments

@droumis
Copy link
Member

droumis commented Jan 9, 2024

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))
image
@droumis droumis added the TRIAGE label Jan 9, 2024
@bryevdv
Copy link
Member

bryevdv commented Jan 9, 2024

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:

Screenshot 2024-01-09 at 12 36 39

Are there any console errors in your browser? I expect JS console message is the best we can do here.

@droumis
Copy link
Member Author

droumis commented Jan 9, 2024

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.

@mattpap
Copy link
Contributor

mattpap commented Jan 9, 2024

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.:
image

and at a much lower threshold than Chromium.

@mattpap
Copy link
Contributor

mattpap commented Jan 9, 2024

I will mark this as a discussion for the time being, but I strongly doubt we can do anything in general here.

@droumis
Copy link
Member Author

droumis commented Jan 10, 2024

sounds good. thanks for investigating! Maybe a note in the documentation would be a sufficient step for the short term.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@mattpap @bryevdv @droumis and others