filmov
tv
How To Create An Animated Bar Chart (Bar Race) In Python Using Plotly & Excel | Tutorial [EASY] ๐ป
ะะพะบะฐะทะฐัั ะพะฟะธัะฐะฝะธะต
๐๐๐ฆ๐๐ฅ๐๐ฃ๐ง๐๐ข๐ก
โโโโโโโโโโโโโโโโโโโโโโโโโโ
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
๐ง๐ข๐ข๐๐ฆ ๐๐ก๐ ๐ฅ๐๐ฆ๐ข๐จ๐ฅ๐๐๐ฆ
โโโโโโโโโโโโโโโโโโโโโโโโโโ
๐๐ข๐ก๐ก๐๐๐ง ๐ช๐๐ง๐ ๐ ๐
โโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐๐๐ ๐บ๐ฒ ๐ฎ ๐ฐ๐ผ๐ณ๐ณ๐ฒ๐ฒ?
ะะพะผะผะตะฝัะฐัะธะธ