Width of Altair vconcat chart not correct
See original GitHub issueSummary
I am trying to implement multiple concatenated charts with same x-axis to share a selection functionality. When adding them to streamlit one at a time, the width seems to adjust to the container automatically, but something goes wrong when adding the concatenated charts.
Steps to reproduce
Code snippet:
import pandas as pd
import numpy as np
import altair as alt
import streamlit as st
st.set_page_config( layout='wide')
x = np.linspace(10,100, 10)
y1 = 5*x
y2 = 1/x
df1 = pd.DataFrame.from_dict({'x': x,'y1': y1, 'y2': y2})
c1 = alt.Chart(df1).mark_line(
).encode(
alt.X('x'),
alt.Y('y1')
)
c2 = alt.Chart(df1).mark_line(
).encode(
alt.X('x'),
alt.Y('y2')
)
#Individual, Static Charts
st.altair_chart(c1, use_container_width = True)
st.altair_chart(c2, use_container_width = True)
#Concatenated Charts with shared zoom function
zoom = alt.selection_interval(bind = 'scales', encodings = ['x'])
st.altair_chart(c1.add_selection(zoom) & c2.add_selection(zoom), use_container_width = True)
Expected behavior:
Concatenated charts of full width with zoom functionality.
Actual behavior:
Concatenated charts of standard width with zoom functionality
Is this a regression?
No.
Debug info
- Streamlit version: 0.76.0
- Python version: 3.8.5
- Using PipEnv
- OS version: macOS Mojave
- Browser version: Chrome
Additional information
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8
Top Results From Across the Web
Compound Charts: Layer, HConcat, VConcat, Repeat, Facet
Along with the basic Chart object, Altair provides a number of compound plot ... width=200, height=200 ).interactive() chart = alt.vconcat(data=iris) for ...
Read more >How should I use use_container_width with vconcat-ed charts?
But with altair charts, width of vconcat-ed charts is not handled well. I'm using streamlit 0.71.0, and just upgraded to 0.72.0.
Read more >Is there a way to customize the placement of concatenated ...
import altair as alt from vega_datasets import data source ... Chart(source, height=200, width=200).mark_circle(size=60).encode( ...
Read more >altair.ConcatChart — Altair 4.1.0 documentation
A chart with horizontally-concatenated facets Mapping(required=[concat]). Attributes ... the general (wrappable) concat operator (not hconcat / vconcat ).
Read more >altair line up concatenated charts into a grid - You.com
I have this so far but this is not working : ... brush.ref() ).properties( width=700, height=300, selection=click ) con = alt.vconcat(stopline, secondline, ...
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
Hi, any update on this, like a target release date?
Would also be happy about a fix