Issue with scattermap box animation


#1

I get the same error when i copy and paste the same code for this -
https://plot.ly/~empet/14825/scattermapbox-animation-forum-question/#/

Here’s the error value
ValueError: Invalid properties specified for object of type plotly.graph_objs.Scatter: (‘lat’, ‘lon’)

I’m able to plot the same thing with the static scatter map, this works:

fig = dict(data=data, layout=layout)
plt.iplot(fig, filename='SimpleMap')

but i get issues when I try to animate. Conceptually, how is the ‘frame’ element supposed to be constructed with ‘lat’ and ‘lon’?

fig=dict(data=data, layout=layout, frames=frames)
plot(fig)

I get the error when the frame element is added to the figure and then, I attempt to plot.


#2

Hi @ghomrighous,

I think the error in the example above is from this line

frames=[dict(data= [dict(lat=lats[:k+1],
                         lon=lons[:k+1])
                   ],
             traces= [0],
             name='frame{}'.format(k)       
            ) for k  in  range(1, len(df))]

The trace types for the traces in the frames are not specified, so they are defaulting to scatter, which doesn’t have lat/lon properties. Try adding type='scattermapbox' here.

frames=[dict(data=[dict(
                         type='scattermapbox',
                         lat=lats[:k+1],
                         lon=lons[:k+1])
                   ],
             traces= [0],
             name='frame{}'.format(k)       
            ) for k  in  range(1, len(df))]

Does that help?
-Jon


#3

Help? Does that help???

That just fixed an issue I’ve been stuck on for like TWO DAYS!!!

YES THAT HELPED!

Thanks!!! (hero?)