Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import pandas as pd | |
| import altair as alt | |
| url = 'https://raw.githubusercontent.com/UIUC-iSchool-DataViz/is445_data/main/building_inventory.csv' | |
| data = pd.read_csv(url) | |
| # Visualization 1: Building Status Distribution | |
| status_chart = alt.Chart(data).mark_bar().encode( | |
| x=alt.X('Bldg Status:N', title='Building Status'), | |
| y=alt.Y('count():Q', title='Number of Buildings'), | |
| color='Bldg Status:N' | |
| ).properties( | |
| title="Distribution of Building Status" | |
| ) | |
| st.altair_chart(status_chart, use_container_width=True) | |
| st.write("### Visualization 1: Distribution of Building Status") | |
| st.write(""" | |
| This bar chart illustrates the distribution of building statuses across categories such as "In Use," "Abandon," and "In Progress." | |
| By assigning unique colors to each category, the chart makes it easy to distinguish between statuses and quickly identify the most | |
| common one. The "In Use" status, highlighted in a bold color, stands out as the dominant category, indicating a high number of active | |
| buildings. This straightforward layout enables a quick overview of building statuses, and with additional time, interactivity like | |
| tooltips or filtering by specific statuses could provide further insights. | |
| """) | |
| # Visualization 2: Primary Usage by Building Status ("In Use") | |
| # Filter data to only include buildings with 'Bldg Status' equal to "In Use" | |
| in_use_data = data[data['Bldg Status'] == "In Use"] | |
| filtered_chart = alt.Chart(in_use_data).mark_bar().encode( | |
| x=alt.X('Usage Description:N', title='Primary Usage Type'), | |
| y=alt.Y('count():Q', title='Number of Buildings'), | |
| color=alt.Color('Usage Description:N', title='Primary Usage Type') | |
| ).properties( | |
| title="Distribution of Primary Usage Type for Buildings In Use", | |
| width=300 | |
| ).configure_axis( | |
| labelAngle=45 | |
| ) | |
| st.altair_chart(filtered_chart, use_container_width=True) | |
| st.write("### Visualization 2: Distribution of Primary Usage Type for Buildings In Use") | |
| st.write(""" | |
| This bar chart focuses on the primary usage types for buildings marked as "In Use," revealing the functional distribution of active buildings. | |
| Each usage type, such as "Assembly," "Industrial," and "Storage," is represented by a different color, making it visually accessible and easy | |
| to compare categories. Rotated labels on the x-axis improve readability for longer usage descriptions, and the chart's filtered focus on active | |
| buildings allows for a targeted analysis of their purposes. If time permitted, adding interactivity, such as tooltips with precise counts or | |
| comparisons across additional statuses, would enhance the depth of insights provided. | |
| """) |