How To Create An Animated Bar Chart (Bar Race) In Python Using Plotly & Excel | Tutorial [EASY] ๐Ÿ’ป

preview_player
ะŸะพะบะฐะทะฐั‚ัŒ ะพะฟะธัะฐะฝะธะต

๐——๐—˜๐—ฆ๐—–๐—ฅ๐—œ๐—ฃ๐—ง๐—œ๐—ข๐—ก
โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€
In this tutorial I will show you, how to create an animated Bar Chart, also known as a Barrace, in Python & Excel by using the library called Plotly.

The data is coming directly from an excel file.
You can do all the changes in the excel file and after running the script again you will have your updated Bar Chart Animation.
The Barrace is also interactive. If you hover over the bars, you will see additional information.
Lastly, the animation will be also saved as an HTML file. Hence, you could also send the animation to your friends & colleagues, who do not even need to have Python installed on their machines.
This tutorial is focusing on beginners in Python. Even you have never written a single line of code in Python, you will be able to have your free animated bar chart by the end of this tutorial.

๐Ÿ‘‰ You can download the code & excel files for FREE here:

๐Ÿ‘ฉโ€๐Ÿ’ป ๐—ฆ๐—ข๐—จ๐—ฅ๐—–๐—˜ ๐—–๐—ข๐——๐—˜:
import pandas as pd
import streamlit as st
import plotly

# Read Data From Excel and store in a variable df [dataframe]

# Store each column in a seperate varibale.
country = df["Country"]
sales = df["Sales"]

# Create Animated Bar Chart and store figure as fig
df,
x=country,
y=sales,
color=country,
animation_frame=date,
animation_group=country,
range_y=[0, 1200],
)

# Save Chart and export to HTML

๐—ง๐—ข๐—ข๐—Ÿ๐—ฆ ๐—”๐—ก๐—— ๐—ฅ๐—˜๐—ฆ๐—ข๐—จ๐—ฅ๐—–๐—˜๐—ฆ
โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€

๐—–๐—ข๐—ก๐—ก๐—˜๐—–๐—ง ๐—ช๐—œ๐—ง๐—› ๐— ๐—˜
โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€

โ˜• ๐—•๐˜‚๐˜† ๐—บ๐—ฒ ๐—ฎ ๐—ฐ๐—ผ๐—ณ๐—ณ๐—ฒ๐—ฒ?
ะ ะตะบะพะผะตะฝะดะฐั†ะธะธ ะฟะพ ั‚ะตะผะต
ะšะพะผะผะตะฝั‚ะฐั€ะธะธ
ะะฒั‚ะพั€

Thanks. Your videos are really easy to follow & very helpful.

verma
ะะฒั‚ะพั€

Hallo Sven, this is pretty awesome. Thanks for helping me learn this cool tech #Winning

tongaib
ะะฒั‚ะพั€

Hello Sven, Thanks for this interesting tutorial... how can I create secondary axis with line chart in this case...?

Ravi-lnhy
ะะฒั‚ะพั€

Hi, If I have to save it as a gif, how can I do it? :(

mariaguadalupebarraganorti
ะะฒั‚ะพั€

Hi, I followed as what you did, but each bar graphs are separated. When one is end and the other starts. The only difference between your codes and mine is the name of x axis.

GolightlyYeni
ะะฒั‚ะพั€

Would you be able to insert this into a streamlit?

sabzuski
ะะฒั‚ะพั€

Instead of DATE if time is there say....
10:12 (min:sec)
10:15 (min:sec)
10:20 (min:sec)

then how to modify code
i.e. date =

to what so we can see in similar way


please answer...๐Ÿ™‚

punjaramborhade
ะะฒั‚ะพั€

How To Create An Animated Line Chart Race In Python ? Thanks!

steepehare