bokeh icon indicating copy to clipboard operation
bokeh copied to clipboard

[BUG] fullscreen delayed trigger

Open rocheseb opened this issue 11 months ago • 3 comments

Software versions

Python version : 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0] IPython version : 8.27.0 Tornado version : 6.4.1 NumPy version : 1.26.4 Bokeh version : 3.5.2 BokehJS static path :
node.js version : (not installed) npm version : (not installed) jupyter_bokeh version : (not installed) Operating system : Linux-4.18.0-513.18.1.el8_9.x86_64-x86_64-with-glibc2.28

Browser name and version

Firefox 133.0.3 (64-bit)

Jupyter notebook / Jupyter Lab version

4.2.5

Expected behavior

I noticed a bug when using the fullscreen tool with figures inside a gridplot with more than 1 rows.

The expectation is that the plot is redrawn to fullscreen right away.

Observed behavior

When going to full screen the subplot will initially be with its initial size in the top left corner, and it gets redrawn in full screen only after interacting with the plot for a little bit (at least two box zooms).

Example code

from bokeh.plotting import figure
from bokeh.layouts import gridplot
from bokeh.io import save, output_file

output_file("test_fullscreen.html")

plot1 = figure(width=400, height=400, title="Plot 1", toolbar_location="above", tools="pan,box_zoom,reset,fullscreen")
plot1.scatter([1, 2, 3], [4, 5, 6], size=10, color="navy", alpha=0.5)

plot2 = figure(width=400, height=400, title="Plot 2", toolbar_location="above", tools="pan,box_zoom,reset,fullscreen")
plot2.scatter([1, 2, 3], [6, 5, 4], size=10, color="green", alpha=0.5)

plot3 = figure(width=400, height=400, title="Plot 3", toolbar_location="above", tools="pan,box_zoom,reset,fullscreen")
plot3.scatter([1, 2, 3], [6, 5, 4], size=10, color="red", alpha=0.5)

plot4 = figure(width=400, height=400, title="Plot 4", toolbar_location="above", tools="pan,box_zoom,reset,fullscreen")
plot4.scatter([1, 2, 3], [6, 5, 4], size=10, color="orange", alpha=0.5)

# Create a gridplot with multiple rows
grid = gridplot([[plot1, plot2], [plot3, plot4]])

for plot in grid.children:
    plot[0].toolbar_location = "above"

# Show the layout
save(grid)

Stack traceback or browser console output

No response

Screenshots

https://github.com/user-attachments/assets/90bd442d-ddf3-4b62-ac6e-66ab71d3e005

rocheseb avatar Jan 03 '25 20:01 rocheseb

@rocheseb please confirm whether this issue exists using the latest release 3.6.2

bryevdv avatar Jan 03 '25 20:01 bryevdv

@bryevdv just reproduced the same behaviour with 3.6.2

rocheseb avatar Jan 03 '25 20:01 rocheseb

It requires manual layout invalidation, because the plot is managed by the grid plot, yet in fullscreen mode it's expected to work standalone. I'm quite surprised it works at all, because there is no mechanism for detaching a plot from a layout when switching modes. I'm tempted to mark this as a duplicate of issue #3598, because so far fullscreen mode was implemented only for standalone plots.

mattpap avatar Jan 03 '25 21:01 mattpap