For the following code without slider animation I got the plot as show in figure-1. As I want to add slider animation on Date
column (using the option animation_frame="Date"
) expecting that the line will be drawn from start point to end point as the slider slides as shown in the Cumulative Lines Animation graph. but the output graph I got is shown in figure-2.
So what changes should I make to get a running line graph as shown in here in the first graph
# Using plotly.express without animation
import plotly.express as px
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')
print(df)
fig = px.line(df, x='Date', y='AAPL.High')
fig.show()
# Using plotly.express with animation
import plotly.express as px
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')
print(df)
fig = px.line(df, x='Date', y='AAPL.High', animation_frame="Date")
fig.show()