Annotating chartsĪltair also allows you to annotate your charts with text, images, and emojis. Notice how the custom colors are still reflected in the chart, even when the Streamlit theme is enabled □įor many more examples of Altair charts with and without the Streamlit theme, check out the. # Bottom panel is a bar chart of weather typeĬolor=alt.condition(click, color, alt.value("lightgray")),Ĭhart = alt.vconcat(points, bars, data=source, title="Seattle Weather: 2012-2015") Size=alt.Size("precipitation:Q", scale=alt.Scale(range=)), # Top panel is scatter plot of temperature vs timeĪlt.X("monthdate(date):T", title="Date"),Ĭolor=alt.condition(brush, color, alt.value("lightgray")), # - a multi-click that is active on the bottom panelīrush = alt.selection_interval(encodings=)Ĭlick = alt.selection_multi(encodings=) # - a brush that is active on the top panel Range=,Ĭolor = alt.Color("weather:N", scale=scale) Here's an example of an Altair chart where manual color passing is done and reflected:ĭomain=, For example, if you want a chart line to be green instead of the default red, you can do it! In other words, although we now enable the Streamlit theme by default, you can overwrite it with custom colors or fonts. If you're wondering if your own customizations will still be taken into account, don't worry! You can still make changes to your chart configurations. St.altair_chart(chart, theme=None, use_container_width=True)Ĭlick the tabs in the interactive app below to see the charts with the Streamlit theme enabled and disabled. St.altair_chart(chart, theme="streamlit", use_container_width=True) Let's look at an example of charts with the Streamlit theme and the native Altair theme: import altair as altĬhart = alt.Chart(source).mark_circle().encode( To disable it, and use Altair's native theme, use theme=None instead. The Streamlit theme is available from Streamlit 1.16.0 through the theme="streamlit" keyword argument. The added benefit is that your charts better integrate with the rest of your app's design. This theme is sleek, user-friendly, and incorporates Streamlit's color palette. Altair charts are displayed using the Streamlit theme by default.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |