import pandas as pd
data = pd.read_csv('weather-check.csv')
import altair as alt
Region = data['US Region'].unique()
dropdown = alt.binding_select(options=Region, name="Select a Region")
selection = alt.selection(type="single", fields=['US Region'], bind=dropdown)
alt.Chart(data).mark_point().encode(x='Age',
y='How do you typically check the weather?',
size = alt.Size('count()'),
tooltip=['Age','US Region','What is your gender?','count()'],
color = 'Do you typically check a daily weather report?',
opacity=alt.condition(selection, alt.value(1), alt.value(0))).add_selection(selection).properties(width=500, height=500)
For the implementation, I used Altair to visualize the data. I chose 2 columns as x and y-axis, different colors to represent whether they check daily weather, size as the amount of record. Also at the bottom, the audience can filter the region by themselves, and have access to each point detail in the chart, which means they can figure out the result without a large description.
Redesign:
selection = alt.selection(type="multi", fields=['How do you typically check the weather?'])
base = alt.Chart(data).properties(width=250, height=250)
hist = base.mark_bar().encode(
x=alt.X('Age'),
y='count()',
color=alt.condition(selection, 'How do you typically check the weather?', alt.value('lightgray'))
).add_selection(selection)
scat = base.mark_circle(color="darkgray").encode(
x=alt.X("How much total combined money did all members of your HOUSEHOLD earn last year?:O",
sort=["-", 'Prefer not to answer', '$0 to $9,999','$10,000 to $24,999','$25,000 to $49,999','$50,000 to $74,999',
'$75,000 to $99,999','$100,000 to $124,999','$125,000 to $149,999','$150,000 to $174,999','$175,000 to $199,999',
'$200,000 and up']),
y='US Region',
size='count()',
).transform_filter(selection)
hist | scat