Commit f46cbf5
authored
feat: add _iter_all_traces helper and rewrite manipulation notebook (#18)
* New helper at line 14:
def _iter_all_traces(fig: go.Figure) -> Iterator:
"""Iterate over all traces in a figure, including animation frames.
Yields traces from fig.data first, then from each frame in fig.frames.
Useful for applying styling to all traces including those in animations.
"""
yield from fig.data
for frame in fig.frames or []:
yield from frame.data
Refactored update_traces to use it (simpler now - removed the separate fig.update_traces() call):
for trace in _iter_all_traces(fig):
if selector is None:
trace.update(**kwargs)
else:
if all(getattr(trace, k, None) == v for k, v in selector.items()):
trace.update(**kwargs)
The helper can now be reused internally wherever trace iteration including animation frames is needed.
* Udpate notebook
* Udpate notebook
* Udpate notebook
* Udpate notebook1 parent c677239 commit f46cbf5
File tree
3 files changed
+167
-475
lines changed- docs/examples
- xarray_plotly
3 files changed
+167
-475
lines changed
0 commit comments