Animating filled-area line charts offline

Is there a clearer guide from the offline Python API that allows animating filled-area line charts such as shown here: https://plot.ly/python/filled-area-animation/

I know the online API makes use of plotly.graph_objs but I am finding it a bit counter-intuitive to find a replacement for the offline API. I also checked the docs on offline plotly animations, and cannot seem to find similar charts as the ones available from the online 1.

Any help is appreciated, I hope I am not being too forward, but having documentations that produces the same output for offline and online APIs would help a lot.

Right, so I figured it out.

from plotly.grid_objs import Grid, Column from the code basically uses Grid and Column to store values to be used for the online charts. So basically containers.

From the code in the OP’s link, replace:

my_columns = []
for k in range(len(appl.Date) - 1):
    my_columns.append(Column(list(appl.Date)[:k + 1], 'x{}'.format(k + 1)))   
    my_columns.append(Column(appl_price[:k + 1], 'y{}'.format(k + 1)))
grid = Grid(my_columns)
py.grid_ops.upload(grid, 'AAPL-daily-stock-price' + str(time.time()), auto_open=False)

with;

my_columns = {}
for k in range(len(appl.Date) - 1):
    my_columns['x{}'.format(k + 1)] = list(appl.Date)[:k + 1]
    my_columns['y{}'.format(k + 1)] = appl_price[:k + 1]

and all grid.get_column_reference... with a dictionary lookup my_columns[...], for example:

grid.get_column_reference('x{}'.format(k + 1)) --> [{'x': my_columns['x{}'.format(k + 1)]

And finally do not use icreate_animations offline, just use the usual iplot. The dictionary my_columns holds that values we need instead of Grid that was used in the example.

Hope this helps whoever finding a solution for this.

1 Like