From the course: Data Visualizations with Plotly

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Creating dropdowns and buttons

Creating dropdowns and buttons - Plotly Tutorial

From the course: Data Visualizations with Plotly

Start my 1-month free trial

Creating dropdowns and buttons

- [Instructor] So far, interactive in this course has meant that you can explore and manipulate the output of a Plotly visual, but it turns out there's even more to how dynamic and interactive charts can be in Plotly. In this lesson, we'll look at how you can use buttons and sliders alongside your visuals, and even animate a visual. After importing Plotly express as px, we'll import the entire gapminder dataset. Next, we'll construct a figure using scatter 3D. This time, however, we'll set animation frame equal to year and animation group equal to country. By doing this, we will animate countries in our visual across years in our dataset. The result is a 3D scatterplot like we've seen before. However now, there's a slider for year on the bottom. Notice the movement as I scroll along. But this isn't all. Notice the play and stop buttons to the left of the slider. By pressing play, we see an animation by country over time.…

Contents