Get startedGet started for free

Rainfall by season slider

The Australian Bureau of Meteorology has contracted you for some follow up work to the visualization they loved on rainfall per month in Sydney.

They would love the ability to cycle through seasons. Not as a change-between as in buttons and dropdowns, but more of a slide-between.

Sounds like the perfect job for a slider!

In this exercise, you are tasked with creating a bar chart of the rainfall data with a slider through the seasons.

You have a rain_pm DataFrame available.

This exercise is part of the course

Introduction to Data Visualization with Plotly in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create the basic figure
fig = ____

# Loop through the states
for season in ['Autumn', 'Winter', 'Spring']:
  	# Subset the DataFrame
    df = rain_pm[rain_pm.Season == season]
    # Add a trace for each season
    fig.add_trace(go.____(x=df[____], y=df[____], name=____))
Edit and Run Code