SmeetPatel commited on
Commit
e5613dd
·
verified ·
1 Parent(s): 68f1d6d

New visualization 2

Browse files
Files changed (1) hide show
  1. app.py +22 -13
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(data)
57
  .mark_circle(size=60)
58
  .encode(
59
  x=alt.X(
60
- "Year Constructed:Q",
61
- title="Year Constructed",
62
- scale=alt.Scale(domain=[1700, data['Year Constructed'].max()], nice = False)),
63
- y=alt.Y("Square Footage:Q", title="Square Footage"),
 
64
  color=alt.Color("Bldg Status:N", title="Building Status"),
65
- tooltip=["Agency Name", "Location Name", "Year Constructed", "Square Footage", "Bldg Status"]
66
  )
67
  .properties(
68
- title="Relationship Between Year Constructed and Square Footage",
69
  width=550,
70
  height=300
71
  )
72
  )
73
 
74
  # Explanation for Visualization 2
75
- st.subheader("Visualization 2: Year Constructed vs. Square Footage")
76
  st.altair_chart(scatter_plot, use_container_width=True)
77
  st.text("""
78
- This scatter plot highlights the relationship between the year a building was constructed and its square footage.
79
  Design choices include:
80
- - The x-axis starts at 1700 to focus on relevant construction years.
81
- - Points are color-coded by building status to differentiate operational buildings from others.
82
- - Tooltips provide additional information about each building for interactive exploration.
 
83
  Future Improvements:
84
- - Adding filtering options by county or usage type could make the analysis more granular.
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
+