I’m trying to animate a 3D surface plot with the slider. And I’m following the Gapminder exmple. In the example it says
layout has two different key
sliders. However when I try to set
figure['layout']['slider'] I get the following error:
plotly.exceptions.PlotlyDictKeyError: 'slider' is not allowed in 'layout'
Path To Error: ['layout']['slider']
So is the example wrong or am I missing something? If I remove the
slider dictionary then the figure does have a slider but it doesn’t update the plot when the slider is moved.
Currently the animation plays all the frames when you load the page. I would like it to stay on the first frame and just update when slider value is changed. Is it possible to do that with plotly?
I can paste the code if that’ll help but it creates the slider in the exact same manner as the example does.
Any help is much appreciated.
@lordlycastle Yes you are right, the dict layout has no key,
slider. It is
Here is a simpler example for starting working with animations and sliders:
Thanks! That got it to work.
A follow up question, now I’m trying to have multiple subplots that I want to update with the slider. I got it to work work by adding the data for second scene in the each
frame dict. However, I have to remove the
traces key from that dict. So my question is where can I find more information on what that is? How would you find out what it does if you were in my place? I don’t want a straight answer, I want to know how to find it out myself. The reference documentation doesn’t have any info on that.
I’m sorry, but I cannot understand your question. Could you be more precise, please?
What is the
traces key in
frame dict for?
Where is the documentation for it? I can’t find it.
@lordlycastle For an animation you define data as a list of traces, frames and layout.
The traces in data represent the starting plot of the animation, while the frames define the updates of data.
traces in a frame points out the indices of traces in data updated by that frame.
traces=#the first trace in data is updated
traces=[0,1]#the first two traces in data are updated
Thanks! Where did you find out what it does? Where’s the documentation? I don’t want to create a new question every time I encounter a new key.