Skip to content

new selector keyword argument that can be function not documented in v4.12.0 #2861

@nicholas-esterer

Description

@nicholas-esterer

We can select graph objects using a function (as said in the CHANGELOG):

>>> import plotly.express as px
>>> df=px.data.tips()
>>> fig=px.scatter(df,x='total_bill',y='tip',facet_row='sex',facet_col='smoker')
>>> list(fig.select_yaxes(lambda ax: ax.title.text == 'tip'))
[layout.YAxis({
    'anchor': 'x', 'domain': [0.0, 0.485], 'title': {'text': 'tip'}
}), layout.YAxis({
    'anchor': 'x3', 'domain': [0.515, 1.0], 'matches': 'y', 'title': {'text': 'tip'}
})]

but it is not documented

>>> help(fig.select_yaxes)
...
    selector: dict or None (default None)
        Dict to use as selection criteria.
        yaxis objects will be selected if they contain
        properties corresponding to all of the dictionary's keys, with
        values that exactly match the supplied values. If None
        (the default), all yaxis objects are selected.
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions