musicflower.plotting.add_dummy_traces

musicflower.plotting.add_dummy_traces(n, fig)[source]

Add empty dummy traces to the figure. This function it to fix a Plotly bug. Each animated time traces “eats” one of the existing traces when animation starts (automatically or when moving the slider). It starts in the order that traces were added. So, to not lose relevant traces, you have to add as many dummy traces as there are animated time traces. This has to be done FIRST, that is, BEFORE any other traces were added.

Parameters
  • n (Union[int, Iterable]) – number of dummy traces; either an integer or an iterable (which will only be used to determine the number of traces to add)

  • fig (Figure) – the figure where to add the dummy traces

Return type

None