Spaces:
Sleeping
Sleeping
New visualization 2
Browse files
app.py
CHANGED
|
@@ -52,34 +52,43 @@ Future Improvements:
|
|
| 52 |
|
| 53 |
# Visualization 2: Relationship Between Year Constructed and Square Footage
|
| 54 |
# This scatter plot explores the relationship between the year a building was constructed and its square footage.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
scatter_plot = (
|
| 56 |
-
alt.Chart(
|
| 57 |
.mark_circle(size=60)
|
| 58 |
.encode(
|
| 59 |
x=alt.X(
|
| 60 |
-
"
|
| 61 |
-
title="
|
| 62 |
-
scale=alt.Scale(domain=[
|
| 63 |
-
|
|
|
|
| 64 |
color=alt.Color("Bldg Status:N", title="Building Status"),
|
| 65 |
-
tooltip=["Agency Name", "Location Name", "
|
| 66 |
)
|
| 67 |
.properties(
|
| 68 |
-
title="Relationship Between
|
| 69 |
width=550,
|
| 70 |
height=300
|
| 71 |
)
|
| 72 |
)
|
| 73 |
|
| 74 |
# Explanation for Visualization 2
|
| 75 |
-
st.subheader("Visualization 2:
|
| 76 |
st.altair_chart(scatter_plot, use_container_width=True)
|
| 77 |
st.text("""
|
| 78 |
-
This scatter plot highlights the relationship between the
|
| 79 |
Design choices include:
|
| 80 |
-
-
|
| 81 |
-
-
|
| 82 |
-
-
|
|
|
|
| 83 |
Future Improvements:
|
| 84 |
-
- Adding
|
| 85 |
""")
|
|
|
|
|
|
| 52 |
|
| 53 |
# Visualization 2: Relationship Between Year Constructed and Square Footage
|
| 54 |
# This scatter plot explores the relationship between the year a building was constructed and its square footage.
|
| 55 |
+
# Remove rows where 'Square Footage' is missing or invalid
|
| 56 |
+
data['Square Footage'] = pd.to_numeric(data['Square Footage'], errors='coerce')
|
| 57 |
+
filtered_data = data.dropna(subset=['Square Footage'])
|
| 58 |
+
|
| 59 |
+
# Visualization 2: Relationship Between Square Footage and Total Floors
|
| 60 |
+
# This scatter plot explores the relationship between the square footage of a building and its total floors.
|
| 61 |
scatter_plot = (
|
| 62 |
+
alt.Chart(filtered_data)
|
| 63 |
.mark_circle(size=60)
|
| 64 |
.encode(
|
| 65 |
x=alt.X(
|
| 66 |
+
"Square Footage:Q",
|
| 67 |
+
title="Square Footage",
|
| 68 |
+
scale=alt.Scale(domain=[filtered_data['Square Footage'].min(), filtered_data['Square Footage'].max()])
|
| 69 |
+
),
|
| 70 |
+
y=alt.Y("Total Floors:Q", title="Total Floors"),
|
| 71 |
color=alt.Color("Bldg Status:N", title="Building Status"),
|
| 72 |
+
tooltip=["Agency Name", "Location Name", "Square Footage", "Total Floors", "Bldg Status"]
|
| 73 |
)
|
| 74 |
.properties(
|
| 75 |
+
title="Relationship Between Square Footage and Total Floors",
|
| 76 |
width=550,
|
| 77 |
height=300
|
| 78 |
)
|
| 79 |
)
|
| 80 |
|
| 81 |
# Explanation for Visualization 2
|
| 82 |
+
st.subheader("Visualization 2: Square Footage vs. Total Floors")
|
| 83 |
st.altair_chart(scatter_plot, use_container_width=True)
|
| 84 |
st.text("""
|
| 85 |
+
This scatter plot highlights the relationship between the square footage of a building and its total floors.
|
| 86 |
Design choices include:
|
| 87 |
+
- Square Footage is represented on the x-axis, as it provides a numeric measure of building size.
|
| 88 |
+
- Total Floors is represented on the y-axis to show the height distribution of buildings.
|
| 89 |
+
- Points are color-coded by building status to differentiate operational buildings.
|
| 90 |
+
- Tooltips provide additional information for exploration.
|
| 91 |
Future Improvements:
|
| 92 |
+
- Adding filters for building usage or region could enhance the analysis.
|
| 93 |
""")
|
| 94 |
+
|