Thank you for watching the video. Your questions are great, but finding the time to answer them is difficult. Kindly understand that I receive many requests for individual solutions or modifications. That said, you might want to join our Discord server ( pythonandvba.com/discord ) and post your question there. Thanks for your understanding. Happy Coding!
Hi, Unfortunately, this currently not possible with Plotly 😥 One (not very elegant) workaround would be to use a free screen to gif software (www.screentogif.com/). Alternatively, I could also recommend you an easy to use a library called "pandas-alive". After you have installed the library (pip install pandas_alive) you could run the following example code: import pandas_alive covid_df = pandas_alive.load_dataset() covid_df.plot_animated(filename='example-barh-chart.gif') Further examples & the full documentation of the library can be found here: pypi.org/project/pandas-alive/ Hope that helps you. Cheers, Sven
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.
*Thank you for watching the video* Could you kindly send me your code to: ✉ contact.coding.is.fun@gmail.com I will have a look at it and get back to you as soon as possible 👍
Thanks for watching the video. Yes, that is possible (see screenshot & code below) 😀 prnt.sc/1do7v1u import plotly.express as px import pandas as pd import streamlit as st import plotly # Read Data From Excel and store in a variable df [dataframe] df = pd.read_excel('data.xlsx', usecols="A:C") df.dropna(inplace=True) # Store each column in a seperate varibale. country = df['Country'] sales = df['Sales'] date = df['Date'].dt.strftime('%Y-%m-%d') # Create Animated Bar Chart and store figure as fig fig = px.bar( df, x=country, y=sales, color=country, animation_frame=date, animation_group=country, range_y=[0,1200] )
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 = df["Date"].dt.strftime("%Y-%m-%d") to what so we can see in similar way ..... please answer...🙂
Thank you very much for watching the video and your comment. Your requirements are well noted. Yet, I receive many requests for creating individual solutions. As much as I want to help, I simply do not find the time in my daily schedule to develop & test all the different requests. I hope you can understand. Thank you!
Thank you very much for watching the video and your comment. Your requirements are well noted. Yet, I receive many requests for creating individual solutions. As much as I want to help, I simply do not find the time in my daily schedule to develop & test all the different requests. I hope you can understand. Thank you! Cheer, Sven ✌️
Thanks. Your videos are really easy to follow & very helpful.
*I am glad you liked the video; thanks for watching and for the comment!*
Hallo Sven, this is pretty awesome. Thanks for helping me learn this cool tech #Winning
A pleasure! Thanks for watching and taking the time to leave a comment! :)
Hello Sven, Thanks for this interesting tutorial... how can I create secondary axis with line chart in this case...?
Thank you for watching the video. Your questions are great, but finding the time to answer them is difficult. Kindly understand that I receive many requests for individual solutions or modifications. That said, you might want to join our Discord server ( pythonandvba.com/discord ) and post your question there. Thanks for your understanding. Happy Coding!
Hi, If I have to save it as a gif, how can I do it? :(
Hi,
Unfortunately, this currently not possible with Plotly 😥
One (not very elegant) workaround would be to use a free screen to gif software (www.screentogif.com/).
Alternatively, I could also recommend you an easy to use a library called "pandas-alive".
After you have installed the library (pip install pandas_alive) you could run the following example code:
import pandas_alive
covid_df = pandas_alive.load_dataset()
covid_df.plot_animated(filename='example-barh-chart.gif')
Further examples & the full documentation of the library can be found here: pypi.org/project/pandas-alive/
Hope that helps you.
Cheers,
Sven
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.
*Thank you for watching the video* Could you kindly send me your code to:
✉ contact.coding.is.fun@gmail.com
I will have a look at it and get back to you as soon as possible 👍
Would you be able to insert this into a streamlit?
Thanks for watching the video. Yes, that is possible (see screenshot & code below) 😀
prnt.sc/1do7v1u
import plotly.express as px
import pandas as pd
import streamlit as st
import plotly
# Read Data From Excel and store in a variable df [dataframe]
df = pd.read_excel('data.xlsx', usecols="A:C")
df.dropna(inplace=True)
# Store each column in a seperate varibale.
country = df['Country']
sales = df['Sales']
date = df['Date'].dt.strftime('%Y-%m-%d')
# Create Animated Bar Chart and store figure as fig
fig = px.bar(
df,
x=country,
y=sales,
color=country,
animation_frame=date,
animation_group=country,
range_y=[0,1200]
)
st.plotly_chart(fig)
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 = df["Date"].dt.strftime("%Y-%m-%d")
to what so we can see in similar way .....
please answer...🙂
Thank you very much for watching the video and your comment. Your requirements are well noted. Yet, I receive many requests for creating individual solutions. As much as I want to help, I simply do not find the time in my daily schedule to develop & test all the different requests. I hope you can understand. Thank you!
How To Create An Animated Line Chart Race In Python ? Thanks!
Thank you very much for watching the video and your comment. Your requirements are well noted. Yet, I receive many requests for creating individual solutions. As much as I want to help, I simply do not find the time in my daily schedule to develop & test all the different requests. I hope you can understand. Thank you! Cheer, Sven ✌️