Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subplot select/update methods for batch updates #1548

Merged
merged 7 commits into from
May 6, 2019
Merged

Conversation

jonmmease
Copy link
Contributor

@jonmmease jonmmease commented May 4, 2019

Overview

This PR is part two of #1484 and a follow-on to #1534.

This adds select_*, for_each_*, and update_* 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 the row/col filtering will not work with plotly_express until it is updated to use the new v4 subplot logic (#1528) for faceting. But the selector based filtering should work now.

Examples

Here are some examples:

Set the tickprefix of all xaxis objects to '$';

fig.update_xaxes({'tickprefix': '$'})

Or only those in the first column

fig.update_xaxes({'tickprefix': '$'}, col=1)

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:

fig.update_yaxes({'ticks': 'outside', 'ticklen': 5}, selector={'type': 'log'})

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

@nicolaskruchten
Copy link
Contributor

huzzah! 🎉

@jonmmease
Copy link
Contributor Author

Merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants