[BUG] Impossible to set max widget/column/plot size
See original GitHub issueFOLLOW THESE INSTRUCTIONS CAREFULLY
ISSUES THAT DO NOT CONTAIN NECESSARY INFORMATION MAY BE CLOSED, IMMEDIATELY
The issue tracker is NOT the place for general support. For questions and technical assistance, come join the Bokeh Project Discourse.
For defects or deficiencies, please provide ALL OF THE FOLLOWING:
ALL software version info (bokeh, python, notebook, OS, browser, any other relevant packages)
Python 3.7.2 bokeh 1.1.0
Description of expected behavior and the observed behavior
We’re trying to display a picture in bokeh server which will scale with the window up to a reasonable defined size.
Only sizing_mode=“fixed” seems to be working and uses the provided with and height, anything else scales infinitely
Complete, minimal, self-contained example code that reproduces the issue
def thumbnail(source: ColumnDataSource, width: int = 800, height: int = 320):
"""
Thumbnail
"""
handler = figure(plot_width=width, plot_height=height,
name='thumbnail', sizing_mode='scale_width')
handler.toolbar.logo = None
handler.toolbar_location = None
handler.x_range = Range1d(start=0, end=width)
handler.y_range = Range1d(start=0, end=height)
handler.xaxis.visible = None
handler.yaxis.visible = None
handler.xgrid.grid_line_color = None
handler.ygrid.grid_line_color = None
handler.outline_line_alpha = 0
thumbnail_update(handler, source, index=0)
return handler
def thumbnail_update(handler: Figure, source: ColumnDataSource,
index: int = 0):
"""
Load the index thumbnail
"""
src = Image.open(BytesIO(b64decode(source.data['thumbnail'][index])))
xdim, ydim = src.size
source = src.convert('RGBA')
img = np.empty((ydim, xdim), dtype=np.uint32)
view = img.view(dtype=np.uint8).reshape((ydim, xdim, 4))
# Copy the RGBA image into view, flipping it so it comes right-side up
view[:, :, :] = np.flipud(np.asarray(source))
# Change figure dimensions based on the new image and update
handler.plot_height = ydim
handler.plot_width = xdim
handler.x_range = Range1d(start=0, end=xdim)
handler.y_range = Range1d(start=0, end=ydim)
handler.image_rgba(image=[view], x=0, y=0, dw=xdim, dh=ydim)
Stack traceback and/or browser JavaScript console output
Screenshots or screencasts of the bug in action
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Unable to properly plot the adgust bar graph size in tkinter
I'm having a dataframe, which needs its missing values to display using tkinter. I'm using the msno.bar() function to visualize this.
Read more >634551 - Cocoa's progress bar widget shouldn't have a max size
If you try to draw a progress widget bigger than a given size, the Cocoa widget will not grow as requested. This is...
Read more >Understanding constraints - Flutter documentation
A constraint is just a set of 4 doubles: a minimum and maximum width, and a minimum and maximum height. Then the widget...
Read more >Flutter: The Advanced Layout Rule Even Beginners Must Know
A “constraint” is just a set of 4 doubles: a minimum and maximum width, ... it's impossible to precisely define the size and...
Read more >Provide flexible widget layouts - Android Developers
In previous versions of Android, it is possible to get the size ranges of a widget ... maxResizeWidth and maxResizeHeight : define the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
using ffmpeg we extract some metadata from a video an convert each frame into a thumbnail, then we plot a bunch of stuff, like bitrate and if you click on plot we display the corresponding thumbnail. This was the only way we could think about to link mouse event in plot to update image.
Is there an example available on updating
Div
content from bokeh?I’ll see if I can provide a MWE. Give me a day or so 😃
This is exactly what I was looking for. Can’t find
max_width, height
in the documentation though.Thanks for the support and sorry for not explaining the problem in a better way.