plotly.js
plotly.js copied to clipboard
In a multi-trace figure the traces that are not animated get invisible when animation starts
Recently I noticed that the old definition of animation frames doesn't work anymore.
More precisely: if I define a subplot with two cells, for example, and want to animate only the traces in a single subplot, then by the initial definition from 2016, I had to set the attribute Frame.traces
on the list of trace indices in fig.data
that are modified from frame to frame. All other traces were visible during the animation.
After a recent plotly.js release (I couldn't identify it) the traces that are not modified within Frame.data
disappear when the animation starts, and I have to extend the list Frame.traces
to the list of all traces in fig.data
because those that are not modified from frame to frame are set invisible by plotly.js. Hence Frame.data
must contain the update visible=True
for these ones.
My question is: is it possible to revert the Frame definition to the old one? Why let users make these settings (visible=True
), and why they are not performed automatically by plotly.js, as it did
for three years?
Here is a simple example to understand better what I'm referring to: https://plot.ly/~empet/15543/
Thanks for posting.
Looks like an unwanted change of behaviour happened during the release of v1.37.0
. I suspect the regression got introduced though https://github.com/plotly/plotly.js/pull/2574
https://codepen.io/etpinard/pen/bGdBWJq uses v1.36.0
, does it behave like you remember?
For reference:
-
codepen showing the bug using
1.52.2
: https://codepen.io/etpinard/pen/dyoOWEx -
codepen showing @empet 's workaround: https://codepen.io/etpinard/pen/JjdbNgV - but please note that setting blank objects for the first two traces of each frame is sufficient (i.e. no need to set
visible: true
), see: https://codepen.io/etpinard/pen/yLNVXBK?editors=1010
So, looks like something goes wrong when mapping the indices from frames[i].traces
to the trace settings in frames[i].data
.
@etpinard The animation in this pen https://codepen.io/etpinard/pen/bGdBWJq, that uses v1.36.0 , displays the Bars only in the first frame. It should display them in all frames.
I think I'm seeing something similar on the plotly.python side using Plotly 4.9.0: https://drive.google.com/file/d/1D4-YdC6n_E0_Oe21X5iknrqwrPNFYeTt/view?usp=sharing
Im seeing similar thing in plotly.python 5.1.0
I am having the same issue in plotly.python 5.6.0. However the aforementioned workaround fixes the issue by setting {}
for all the other non animated traces.