Daily Dose of Data Science

Share this post

A Lesser-known Feature of Creating Plots with Plotly

www.blog.dailydoseofds.com

Discover more from Daily Dose of Data Science

High-quality insights on Data Science and Python, along with best practices — shared daily. Get a free 550+ page data science PDF guide and 450+ practice questions notebook.
Over 49,000 subscribers
Continue reading
Sign in

A Lesser-known Feature of Creating Plots with Plotly

Enrich static plots with animations.

Avi Chawla
Apr 9, 2023
11
Share this post

A Lesser-known Feature of Creating Plots with Plotly

www.blog.dailydoseofds.com
4
Share

Plotly is pretty diverse when it comes to creating different types of charts. While many folks prefer it for interactivity, you can also use it to create animated plots.

Here's an animated visualization depicting the time taken by light to reach different planets after leaving the Sun.

Size of planets not to scale

Several functions in Plotly support animations using the animation_frame and animation_group parameters.

The core idea behind creating an animated plot relies on plotting the data one frame at a time.

For instance, consider we have organized the data frame-by-frame, as shown below:

Now, if we invoke the scatter method with the animation_frame argument, it will plot the data frame-by-frame, giving rise to an animation.

In the above function call, the data corresponding to frame_id=0 will be plotted first. This will be replaced by the data with frame_id=1 in the next frame, and so on.

Thanks for reading Daily Dose of Data Science! Subscribe for free to learn something new and insightful about Python and Data Science every day.

Find the code for this post here: GitHub.

👉 Read what others are saying about this post on LinkedIn.

👉 Tell me you liked this post by leaving a heart react ❤️.

👉 If you love reading this newsletter, feel free to share it with friends!


I like to explore, experiment and write about data science concepts and tools. You can read my articles on Medium. Also, you can connect with me on LinkedIn and Twitter.

11
Share this post

A Lesser-known Feature of Creating Plots with Plotly

www.blog.dailydoseofds.com
4
Share
Previous
Next
4 Comments
Share this discussion

A Lesser-known Feature of Creating Plots with Plotly

www.blog.dailydoseofds.com
D.W. Eversole
Writes Outside The Box
Apr 9Liked by Avi Chawla

I love this. I can think of a dozen applications for this with my work. Thanks

Expand full comment
Reply
Share
1 reply by Avi Chawla
John Davenport
Writes Serial Hobbyist
Apr 9Liked by Avi Chawla

This is a nice intro to a unique data visualization technique. Thanks for sharing.

Expand full comment
Reply
Share
1 reply by Avi Chawla
2 more comments...
Top
New
Community

No posts

Ready for more?

© 2023 Avi Chawla
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing