Spaces:
Sleeping
Sleeping
File size: 1,948 Bytes
04603f4 b09a261 04603f4 6a71944 b09a261 04603f4 7141fdc 8c74149 04603f4 b09a261 04603f4 b09a261 04603f4 b09a261 04603f4 b09a261 04603f4 b09a261 e6034bc 04603f4 e6034bc 04603f4 e6034bc 04603f4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
import pandas as pd
import streamlit as st
import altair as alt
# Main title for the app
st.title("Streamlit App for IS445: ID29937")
# Text description with URL
st.text("The URL for this app is: https://huggingface.co/spaces/Shrek29/is445_demo")
# Divider to separate sections
st.divider()
# Header for the scatter plot section
st.header("Scatter Plot of Weather Data from the BFRO Dataset")
source = "https://raw.githubusercontent.com/UIUC-iSchool-DataViz/is445_data/main/bfro_reports_fall2022.csv"
data = pd.read_csv(source).dropna()
# Scatter plot using Altair
scatter = (
alt.Chart(data).mark_circle().encode(
alt.X('visibility:Q').title('Visibility'),
alt.Y('wind_speed:Q').title('Wind Speed'),
alt.Color('season:N').scale(scheme="set2"), # Using 'set2' color scheme
alt.Size('temperature_high:Q'),
alt.Tooltip(['visibility', 'wind_speed', 'season', 'pressure'])
).interactive()
)
st.altair_chart(scatter, use_container_width=True)
# Divider to separate sections
st.divider()
# Header for mixed chart section
st.header("Mixed Chart of Weather Data from the BFRO Dataset")
pts = alt.selection_point(encodings=['x'])
rect = alt.Chart(data).mark_rect().encode(
alt.X('uv_index:Q').bin().title('UV Index'),
alt.Y('cloud_cover:Q').bin().title('Cloud Cover'),
alt.Color('count()').scale(scheme='greens').title('Count of UV Index'),
)
circ = rect.mark_point().encode(
alt.ColorValue('darkred'), # Change point color to dark red
alt.Size('count()').title('Count of Cloud Cover')
).transform_filter(pts)
bar = alt.Chart(data, width=550, height=200).mark_bar().encode(
x='season:N',
y='count()',
color=alt.condition(pts, alt.ColorValue("orange"), alt.ColorValue("grey"))
).add_params(pts)
special = alt.vconcat(
rect + circ,
bar
).resolve_legend(
color="independent",
size="independent"
)
# Display mixed chart
st.altair_chart(special)
|