Spaces:
Build error
Build error
Upload app.py
Browse files5 unmodified lines678991011127 unmodified lines202122232324252639 unmodified lines66676869697071727273747475767576777879798081825 unmodified linesst.set_page_config(page_title="IL Crop Rotation Explorer", layout="wide")
st.title("🌾 Illinois Crop Rotation and Land Use Exploration")
st.markdown("Explore dominant crops and land use characteristics across Illinois fields from 2010–2020. This dashboard is for exploration and pattern recognition.")
st.markdown("Explore dominant crops and land use characteristics across Illinois fields from 2010–2020. This dashboard is for exploration and pattern recognition. Dashboard created by Sara Kiel.")
# Load data
@st.cache_data7 unmodified linesgenlu_options = sorted(df['GenLU'].dropna().unique())
selected_crops = st.sidebar.multiselect("Filter by Crop", crop_options, default=crop_options[:5])
selected_genlu = st.sidebar.multiselect("Filter by General Land Use", genlu_options, default=genlu_options)
selected_genlu = st.sidebar.multiselect("Filter by General Land Use", genlu_options, default=genlu_options[:5])
filtered = df[df['crop_name'].isin(selected_crops) & df['GenLU'].isin(selected_genlu)]
39 unmodified lines)
# -- Boxplot: Rotation Diversity by Land Use --
rotation_box = alt.Chart(df).mark_boxplot().encode(
rotation_box = alt.Chart(filtered).mark_boxplot().encode(
x=alt.X('GenLU:N', title='General Land Use'),
y=alt.Y('rotation_diversity:Q', title='Rotation Diversity'),
color='GenLU:N'
color='GenLU:N',
tooltip=['GenLU', 'rotation_diversity']
).properties(
width=350,
height=400,
title='Rotation Diversity by Land Use'
title='Rotation Diversity by Land Use (Filtered)',
width=800,
height=400
)
# ---- Layout ----
st.altair_chart(area_chart, use_container_width=True)
st.altair_chart(scatter, use_container_width=True)app.py+8-8