Create Racing Bar Graph - Python Plotly

preview_player
Показать описание
Learn how to create a Racing Bar graph all in Python, using Plotly. We will be using real-life data on suicide rates around the world. Links below:

Racing Bar Chart video example:

The Code:

Data:

Plotly Bar Graph Documentation:

Plotly Forum:

Video Layout:
00:39 - Data Used
02:00 - Dictionary of Frames/Years
05:52 - Creating the Figure
09:37 - The Play Button
13:40 - Final Result
15:11 - Tip of the Week
Рекомендации по теме
Комментарии
Автор

I wonder if there is a way to create those fancy racing bar graph where you can see the effect of bars jumping over bars vertically, as their values exceed the values of those on top of them.

ygbr
Автор

If you came to learn how to increase the suicide rate, this video is not the thing you should watch. Otherwise, its very interesting.

aomanchutube
Автор

Hello, thanks for this video. From this video I am able to create a racing graph. Just wanted to know if the bar movement animation is possible using Plotly?
I saw multiple videos where it is there, but all of them were made with flourish studio (I guess)

AKRONA
Автор

Any Chance you could show how to add a slider and a pause button for this or on Plotly Express? Thanks!!

davedave
Автор

Hi, great content!! I have one question:


How to make the transition more smooth like we could find in other Race Bar Charts using Flourish or Power Bi?
More precisely I would like to see the bars moving from one position to another during the transition from one value to the new one.


This snippet of code seems to do the job:


buttons=[dict(label="Play",
method="animate",
args=[None,
{"frame": {"duration": 2*1000, "redraw": True}, # 10*1000ms
"transition": {"duration":250,
"easing": "linear-in"}}]


What do you recommend for the argument "easing" to achieve the desired "moving effect"?

mastafafoufa
Автор

Hello and thanks for the great content. Just a quick question. Can I have a racebar for each one of the continents using a dropdown? So basically do what you did for Europe, but for all the continents and then i choose each one of them via a dropdown.

uni
Автор

Hello, there Thank you again for this wonderful explanation. In my graph the text in the bar with maximum value disappears and reappear time to time. How do I address the issue. I tried defining range but not to my avail.

ravikiranyadav
Автор

how can i change the code if my data set doesn't have a color code column?

niki
Автор

Sir, I want to do a Bar chart race on Corona. i will Share Dataset of Corona from WHO. I Have Problem in Coding... So can you help me

goutamsahu
Автор

can we plot by dates instead of years ????

rajsaraiya
visit shbcf.ru