Fix scattergl animation index out of range in for loop#7676
Merged
camdecoster merged 7 commits intoplotly:masterfrom Jan 16, 2026
Merged
Fix scattergl animation index out of range in for loop#7676camdecoster merged 7 commits intoplotly:masterfrom
camdecoster merged 7 commits intoplotly:masterfrom
Conversation
Contributor
|
Thanks for the PR! Before we review, could you please provide some videos showing the change? |
Contributor
Author
before.mp4after.mp4 |
camdecoster
approved these changes
Jan 14, 2026
Co-authored-by: Cameron DeCoster <[email protected]>
7c19822 to
57c2f5f
Compare
Contributor
Author
|
Thanks for the review @camdecoster ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal: Fix runtime error when "animating" scattergl traces. I don't believe scattergl traces actually support animations like easing and redraw=False, but they should at least not hit a runtime error.
As shown in #6251 , there is an unsafe index into
cdatawith variableibecause variableicomes from scene.count and not cdata.length. This is normally fine. However, during frame redraw animations, we may call scattergl.plot with a subset of calcdata, so cdata.length can be < scene.count.Further up in traces/scattergl/plot.py there was already an instance of checking if cdata[i] is undefined, so I've mirrored that into the for loop.
Fixes #6251.
This should also fix #6897 which is the same error as #6251.