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.
Description
When plotting a large number of objects (>500). The plotly plottting backend starts to struggle rendering all the objects. When displaying a large collection of similar objects within a collection it is possible to group and merge the similar traces into a much smaller number of traces. This drastically improves browser rendering performance. In this PR, a method is implemented to group and merge traces based on criteria such as
("legendgroup", "line", "marker", "colorscale", ...)
.Of Course, this only applies if the object are displayed within a Collection and are not unpacked in the
show
function, since otherwise every object gets it's own legend entry and therefore its own trace, which would prevent merging.Open topics
More performance increase could be achieved on the construction of the object on python side though.
Since there is no API change and it is also not really a new feature this could be merged and released as a patch (e.g. 4.0.1) @OrtnerMichael what do you think
Example
It can still take some time to create and merge the objects (approx 10sec in this case), but the rendering of more than 5000 merged cuboids is almost instantaneous.
