JanhaviZarapkar commited on
Commit
30515e1
·
verified ·
1 Parent(s): f11ba3b

New changes

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -2,6 +2,9 @@ import pandas as pd
2
  import streamlit as st
3
  import altair as alt
4
 
 
 
 
5
  # Load and clean dataset
6
  url = "https://raw.githubusercontent.com/UIUC-iSchool-DataViz/is445_data/main/building_inventory.csv"
7
  df = pd.read_csv(url, na_values={'Year Acquired': 0, 'Year Constructed': 0, 'Square Footage': 0})
@@ -64,7 +67,7 @@ stacked_bar_chart_county = alt.Chart(county_agency_building).mark_bar().encode(
64
  )
65
 
66
  # Display the stacked bar chart in Streamlit
67
- st.altair_chart(stacked_bar_chart_county)
68
 
69
  # Write-up for Stacked Bar Chart
70
 
@@ -90,6 +93,7 @@ If I had more time, I would focus on adding **interactivity** by implementing fi
90
  st.markdown("""
91
  <h2 style="width: 800px;">Visualization 2: County, Total Floors, and Square Footage</h2>
92
  """, unsafe_allow_html=True)
 
93
  bubble_chart = alt.Chart(df).mark_circle().encode(
94
  x=alt.X('County:N', title='County'),
95
  y=alt.Y('sum(Square Footage):Q', title='Total Square Footage (sq ft)'),
@@ -102,7 +106,7 @@ bubble_chart = alt.Chart(df).mark_circle().encode(
102
  title="Relationship Between County, Square Footage, and Total Floors"
103
  )
104
 
105
- st.altair_chart(bubble_chart)
106
 
107
 
108
  # Write-up for Bubble Chart
@@ -139,7 +143,7 @@ heatmap = alt.Chart(df).mark_rect().encode(
139
  title="Heatmap of Building Count by County and Status"
140
  )
141
 
142
- st.altair_chart(heatmap)
143
 
144
 
145
 
 
2
  import streamlit as st
3
  import altair as alt
4
 
5
+ alt.themes.enable('default') # Use Altair's default responsive theme
6
+
7
+
8
  # Load and clean dataset
9
  url = "https://raw.githubusercontent.com/UIUC-iSchool-DataViz/is445_data/main/building_inventory.csv"
10
  df = pd.read_csv(url, na_values={'Year Acquired': 0, 'Year Constructed': 0, 'Square Footage': 0})
 
67
  )
68
 
69
  # Display the stacked bar chart in Streamlit
70
+ st.altair_chart(stacked_bar_chart_county,use_container_width=True)
71
 
72
  # Write-up for Stacked Bar Chart
73
 
 
93
  st.markdown("""
94
  <h2 style="width: 800px;">Visualization 2: County, Total Floors, and Square Footage</h2>
95
  """, unsafe_allow_html=True)
96
+
97
  bubble_chart = alt.Chart(df).mark_circle().encode(
98
  x=alt.X('County:N', title='County'),
99
  y=alt.Y('sum(Square Footage):Q', title='Total Square Footage (sq ft)'),
 
106
  title="Relationship Between County, Square Footage, and Total Floors"
107
  )
108
 
109
+ st.altair_chart(bubble_chart,use_container_width=True)
110
 
111
 
112
  # Write-up for Bubble Chart
 
143
  title="Heatmap of Building Count by County and Status"
144
  )
145
 
146
+ st.altair_chart(heatmap, use_container_width=True)
147
 
148
 
149