Update app.py
Browse files
app.py
CHANGED
@@ -65,7 +65,15 @@ def ListMaps():
|
|
65 |
st.markdown(MapInfo)
|
66 |
return MapInfo
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
|
|
69 |
def plot_state_outline(state_code, us_states_geojson, state_names):
|
70 |
state_name = state_names.get(state_code, 'Unknown')
|
71 |
fig = px.choropleth(locations=[state_name], geojson=us_states_geojson,
|
@@ -75,29 +83,17 @@ def plot_state_outline(state_code, us_states_geojson, state_names):
|
|
75 |
fig.update_layout(title=f"{state_name} State Outline")
|
76 |
st.plotly_chart(fig)
|
77 |
|
|
|
78 |
def PlotOutlines():
|
79 |
geojson_path = 'gz_2010_us_040_00_500k.json'
|
80 |
with open(geojson_path, 'r') as file:
|
81 |
us_states_geojson = json.load(file)
|
82 |
-
|
83 |
-
state_names = {
|
84 |
-
'MN': 'Minnesota', 'CA': 'California', 'WA': 'Washington',
|
85 |
-
'FL': 'Florida', 'TX': 'Texas', 'NY': 'New York', 'NV': 'Nevada'
|
86 |
-
}
|
87 |
-
|
88 |
-
states = ['MN', 'CA', 'WA', 'FL', 'TX', 'NY', 'NV']
|
89 |
-
icons = ['🦆', '🌴', '🍎', '🌞', '🤠', '🗽', '🎰']
|
90 |
-
|
91 |
for state, icon in zip(states, icons):
|
92 |
st.write(f"{icon} {state}")
|
93 |
plot_state_outline(state, us_states_geojson, state_names)
|
94 |
-
|
95 |
return us_states_geojson
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
# Main code
|
101 |
st.title('U.S. States Trivia 🗺️')
|
102 |
|
103 |
for i, (state, icon) in enumerate(zip(states, icons)):
|
|
|
65 |
st.markdown(MapInfo)
|
66 |
return MapInfo
|
67 |
|
68 |
+
# States and Icons
|
69 |
+
states = ['MN', 'CA', 'WA', 'FL', 'TX', 'NY', 'NV']
|
70 |
+
icons = ['🦆', '🌴', '🍎', '🌞', '🤠', '🗽', '🎰']
|
71 |
+
state_names = {
|
72 |
+
'MN': 'Minnesota', 'CA': 'California', 'WA': 'Washington',
|
73 |
+
'FL': 'Florida', 'TX': 'Texas', 'NY': 'New York', 'NV': 'Nevada'
|
74 |
+
}
|
75 |
|
76 |
+
# Plot a State
|
77 |
def plot_state_outline(state_code, us_states_geojson, state_names):
|
78 |
state_name = state_names.get(state_code, 'Unknown')
|
79 |
fig = px.choropleth(locations=[state_name], geojson=us_states_geojson,
|
|
|
83 |
fig.update_layout(title=f"{state_name} State Outline")
|
84 |
st.plotly_chart(fig)
|
85 |
|
86 |
+
# Plot a List of States
|
87 |
def PlotOutlines():
|
88 |
geojson_path = 'gz_2010_us_040_00_500k.json'
|
89 |
with open(geojson_path, 'r') as file:
|
90 |
us_states_geojson = json.load(file)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
for state, icon in zip(states, icons):
|
92 |
st.write(f"{icon} {state}")
|
93 |
plot_state_outline(state, us_states_geojson, state_names)
|
|
|
94 |
return us_states_geojson
|
95 |
|
96 |
+
# Main
|
|
|
|
|
|
|
97 |
st.title('U.S. States Trivia 🗺️')
|
98 |
|
99 |
for i, (state, icon) in enumerate(zip(states, icons)):
|