Responsive sizing on width or weight
See original GitHub issueTo enable responsive sizing on width or weight, vega-lite allow the "container"
option.
However, Altair throws an error:
source = pd.DataFrame(
{
"a": ["A", "B", "C", "D", "E", "F", "G", "H", "I"],
"b": [28, 55, 43, 91, 81, 53, 19, 87, 52],
}
)
chart = (
alt.Chart(source, width="container", height=120)
.mark_bar()
.encode(x="a", y="b")
.to_json()
)
'container' is not of type 'number'
.
Is there a way to allow responsive size in Altair?
As a side note, I use altair with vega-embed
to display vega-lite plot on a Flask app.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to set weight and height in Css with responsive when ...
Simply define the image as a percent of its parent. Below the image is 40% width of the page and will consequently scale...
Read more >Screen sizes and breakpoints - Windows apps - Microsoft Learn
This table describes the different size classes and breakpoints. Responsive design breakpoints. Size class, Breakpoints, Typical screen size ...
Read more >How To Create Responsive Images - W3Schools
Responsive images will automatically adjust to fit the size of the screen. ... on responsiveness, set the CSS width property to 100% and...
Read more >Mobile Responsive Screen Sizes - AccessAlly
Get the latest mobile responsive screen sizes so you can design mobile friendly web pages and ... The average phone width in pixels...
Read more >LESSON 8. Responsive Sizing For Different Devices In Divi
In this lesson of our free mini-course on making Divi responsive, we are looking into all the responsive settings in the Design tab...
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
The
"container"
option will be added in Vega-Lite 4.0, which has not yet been released (The Vega-Lite team keeps their docs pinned to unreleased development versions, which leads to a dozen or so questions like this in every release cycle).Once Vega-Lite 4.0 is released, we will work on releasing Altair 4.0, at which point this feature will be supported.
In that case, try putting the chart in div with a set width. If the div has no width specified, the browser will set its width based on the content. When the content in turn is setting its width based on the width of its container, the result is not generally ideal.