subplot select/update methods for batch updates #1548
Merged
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.
Overview
This PR is part two of #1484 and a follow-on to #1534.
This adds
select_*
,for_each_*
, andupdate_*
methods to the figure class for each subplot container type. These methods work exactly like the trace counterparts from #1534.These will be especially useful when used with
plotly_express
. Note that therow
/col
filtering will not work withplotly_express
until it is updated to use the new v4 subplot logic (#1528) for faceting. But theselector
based filtering should work now.Examples
Here are some examples:
Set the
tickprefix
of all xaxis objects to '$';Or only those in the first column
In addition to row/col filters. updates can also be filtered on selectors as described in #1534.
So if, for some reason, you needed to update only the y axis objects that were configured in log scale to show length 5 ticks:
Other notes
With this PR, we now rely on code generation to determine the set of subplot types. So when new ones show up, like coloraxis, these should now be handled automatically.
cc @nicolaskruchten