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

bokeh layout with different size elements does not pack tightly #3910

Closed
johnzzzzzzz opened this issue Aug 16, 2019 · 1 comment
Closed

bokeh layout with different size elements does not pack tightly #3910

johnzzzzzzz opened this issue Aug 16, 2019 · 1 comment

Comments

@johnzzzzzzz
Copy link

I am trying to make a layout with 4 skinny elements tightly packed on one row followed by 1 long element in the next row.

The row of small elements packed nicely to the left before the bokeh layout refactor #3450
Now the elements are aligned in columns, with the column width equal to the max width of the elements in that column.
Is there a trick to Layout rows with multiple objects on one row that are tightly packed and a single object on the next row? Not like this
HoloviewsLayoutDoesNotPack
Also when using sizing_mode='fixed', I get the error:
WARNING:bokeh.core.validation.check:W-1005 (FIXED_SIZING_MODE): 'fixed' sizing mode requires width and height to be set: Column(id='1009', ...)

I am using holoviews version '1.12.5' and bokeh version '1.2.0' from a fresh install of anaconda python 2.7 as of Aug 15, 2019

import holoviews as hv
hv.extension('bokeh')
def block(height=100, width=100, color='yellow'):
    # Create a dvi of a fixed size and a colored block inside
    template = '<svg>  <rect x="0" y="0" width="{width}" height="{height}", fill="{color}"/>{color}</svg>'
    rect = template.format(**locals())
    return hv.Div(rect).opts(height=height, width=width)

layout = (
    block(width=100, height=100, color='red') + 
    block(width=100, height=100, color='blue') + 
    block(width=100, height=100, color='green') + 
    block(width=100, height=100, color='yellow') + 
    block(width=400, height=100, color='gray') 
    # block(width=10,  height=10,  color='purple') +
    # block(width=10,  height=10,  color='orange') +
    # block(width=10,  height=10,  color='brown')
).cols(4)

sizing_modes = [ None, "fixed", "stretch_width", "stretch_height", "stretch_both",
                "scale_width", "scale_height", "scale_both"]
exp = dict()
for sizing in sizing_modes:
    exp[sizing] = layout.opts(sizing_mode = sizing,
                                height=200,
                                width=400,
                                title=str(sizing),
                                clone=True)
exp['fixed']
@philippjfr
Copy link
Member

This is not in scope for HoloViews Layout. We are planning on adding more complex layouts but if you need this now I'd recommend using Panel Rows and Columns. The generalization of layouts is covered by this very old issue.

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

No branches or pull requests

2 participants