ScatterGeo with a slider

Hello Plotly community!

I used python to create a scatter map of terror attacks with a slider that moves from year to year. I am not sure if this is a bug or I am just missing a parameter in layout or slider but I am currently facing this problem below.

It shows every data point in the map when it first opens, which causes the html page to be really slow (frustrating). Instead of the above, I am supposed to have the below, only a few data points.

Is there anything that I can do to fix it?
Thank you
p.s url:

1 Like

Hi !
It is because you set all the scattergeo dicts (all the years) in or something similar (It seems like only the first year of data is needed), I had the same problem. Anyway do you find a way to make the slider works with scattergeo points? I am actually stuck

I have made it work using the plotly.offline.plot function, and not the iplot one. Unfortunately, it opens a web page and doesn’t work inside my notebook. If someone finds a way to plot in offline mode such interactive graph in a notebook, I would be pleased to hear your solution

Hi @doteur,

Are you saying that the interaction works using plotly.offline.plot as a stand-alone page, but not using plotly.offline.iplot in the notebook? Could you post the full code for a minimal example that reproduces the issue?


Yes that’s what I was saying. But in fact I wasn’t running plotly.offline.iplot in a pure notebook but directly in Atom using Hydrogen plugin (which has similar functionnalities), where it doesn’t seems to work. I tried in a jupyter notebook and it worked.
Sad for the bug in Hydrogen though…

After having fought with sliders and animations in plotly, I now can tell that my previous responses here were more related to another post: Slider for map marker+lines plotting
Original post is still relevant. In order to have only one step of data printed at first, I tried to put a value to each steps, and set to one of this value. This does not work for me

I have found a way to make it work adding to all the dict element visible=False but the ones of the first year to visible=True. It makes the first plot when loading the chart showing only the first year data. When sliding, the visible attribute of all dict is reset and only the ones in the step are set to True, so it works.