alt.Chart height is being removed

Very likely I could me missing something here, but how do I change/increase the height of an Altair plot in Streamlit. I can set the width and height properties for my alt.Chart but once in Streamlit only the width is implemented.

I notice in st.altair_chart there is a width but not height argument. Just wondering why this is?

Having the exact same issue here. I have a bar chart with the values all squeezed and seem to be unable to force it to use the height value I pass.


Hi @wotaskd and @m.bennet! Welcome to the community! :hugs:

Have you tried setting the height directly in the alt.Chart constructor like this:

That worked for me!

Thanks @Adrien_Treuille! I had put the height argument in the alt.Chart definition. Playing around I’ve worked out that passing st.altair_chart(alt.layer(chart)) rather than st.altair_chart(chart) makes the difference :slight_smile:

Thanks for creating a great tool!!

I actually have tried setting the height directly in the constructor but the tip above made it work. Thanks, @m.bennet!