visualizeData / app.py
AAhad's picture
updated cache
4306dcf verified
raw
history blame
819 Bytes
import streamlit as st
import plotly.express as px
import plotly.graph_objects as go
import inspect
@st.experimental_memo
def get_chart_68636849():
import plotly.express as px
import numpy as np
df = px.data.gapminder().query("year == 2007")
fig = px.treemap(df, path=[px.Constant("world"), 'continent', 'country'], values='pop',
color='lifeExp', hover_data=['iso_alpha'],
color_continuous_scale='RdBu',
color_continuous_midpoint=np.average(df['lifeExp'], weights=df['pop']))
fig.update_layout(margin = dict(t=50, l=25, r=25, b=25))
tab1, tab2 = st.tabs(["Streamlit theme (default)", "Plotly native theme"])
with tab1:
st.plotly_chart(fig, theme="streamlit")
with tab2:
st.plotly_chart(fig, theme=None)