2
votes

I am trying to animate a multi series line graph using plotly. However after days of going through the documentation I still can't seem to find a solution.

Currently my code is as follows:

df = px.data.gapminder().query("continent=='Oceania' ")
fig = px.line(df, x="year" , y="lifeExp", color="country" , animation_frame="year", animation_group="lifeExp" , range_y=[68,84] , range_x=[1950,2010])

plot(fig)

This however generates and empty plot. Please help.

I am able to successfully generate a scatter plot and a bar graph using similar code.

For better understanding please view below link : I have found an exact example of what I am looking for implemented in R.

https://plot.ly/r/cumulative-animations/#cumulative-lines-animation

1

1 Answers

1
votes

For the empty plot, try changing the default renderer by adding this above your code:

import plotly.io as pio
pio.renderers.default = 'notebook'

There is some documentation on different renderers.