question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`hv.Layout` with `sizing_mode=scale_both` on its elements results in empty plot

See original GitHub issue

Let’s say you want to create a responsive hv.Layout with tabs. If the elements of a hv.Layout have sizing_mode=scale_both (or any sizing_mode other than fixed for that matter), the resulting plot will be empty.

I suspect this is related to @philippjfr’s comment (https://github.com/ioam/holoviews/issues/1230#issuecomment-289912599):

The thing is that a Layout does not determine it’s own size, instead all the elements making up a Layout do.

Below is a minimal example that reproduces the problem:

import numpy as np
import holoviews as hv

scatter_plots = [
    hv.Scatter(
        (np.random.randn(10), np.random.randn(10)),
        label=str(i)).opts(
            plot={
                'width': 300,
                'height': 300,
                'sizing_mode': 'scale_both'  # [1]
            })
    for i in range(5)]

hv.Layout(scatter_plots).opts(
    plot={
        'tabs': True,
        'sizing_mode': 'scale_both'
    })

# Displays an empty plot unless [1] is set to 'fixed'.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
philippjfrcommented, Feb 21, 2019

In 1.12 we will be completely overhauling the layouts, at that point you can set responsive=True which will default to scale both behavior.

1reaction
jbednarcommented, Apr 29, 2019

You should be able to specify the aspect or the data_aspect, depending on whether you want to specify the shape on the screen or the ratio of data values.

Read more comments on GitHub >

github_iconTop Results From Across the Web

`hv.Layout` with `sizing_mode=scale_both` on its elements ...
Layout have sizing_mode=scale_both (or any sizing_mode other than fixed for that matter), the resulting plot will be empty. I suspect this is ...
Read more >
Working with Plot and Renderers — HoloViews v1.15.3
For this purpose we will create a relatively complex object, a Layout of HoloMap s containing Overlay s containing Elements . We'll instantiate...
Read more >
Holoviews scatterplot is giving empty plot - Stack Overflow
I am trying to create a scatter plot with a DataFrame. But holoviews scatter function is giving me empty plot without any data...
Read more >
How to add a histogram to just the x-axis? - HoloViews
Hi! I'm wondering how I add a histogram to just the x-axis. Surprisingly (to me) this adds a histogram to the y-axis: import...
Read more >
Lesson 27: High level plotting with HoloViews
What kind of plotting element are you making (e.g., scatter, box-and-whisker, heat map, etc.). What columns specify the dimensions of the data, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found