Skip to content

Selector accept int string #2894

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

Merged
merged 11 commits into from
Nov 19, 2020
34 changes: 20 additions & 14 deletions packages/python/plotly/codegen/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,18 @@ def __init__(self, data=None, layout=None,
frames=None, skip_invalid=False, **kwargs):
\"\"\"
Create a new :class:{fig_classname} instance

Parameters
----------
data
{data_description}

layout
{layout_description}

frames
{frames_description}

skip_invalid: bool
If True, invalid properties in the figure specification will be
skipped silently. If False (default) invalid properties in the
Expand Down Expand Up @@ -233,8 +233,8 @@ def add_{trace_node.plotly_name}(self"""
* If False, only select yaxis objects associated with the primary
y-axis of the subplot.
* If None (the default), do not filter yaxis objects based on
a secondary y-axis condition.
a secondary y-axis condition.

To select yaxis objects by secondary y-axis, the Figure must
have been created using plotly.subplots.make_subplots. See
the docstring for the specs argument to make_subplots for more
Expand Down Expand Up @@ -287,7 +287,7 @@ def for_each_{singular_name}(
\"\"\"
Apply a function to all {singular_name} objects that satisfy the
specified selection criteria

Parameters
----------
fn:
Expand Down Expand Up @@ -329,7 +329,7 @@ def update_{plural_name}(
\"\"\"
Perform a property update operation on all {singular_name} objects
that satisfy the specified selection criteria

Parameters
----------
patch: dict
Expand Down Expand Up @@ -395,15 +395,17 @@ def select_{method_prefix}{plural_name}(

Parameters
----------
selector: dict, function, or None (default None)
selector: dict, function, int, str, or None (default None)
Dict to use as selection criteria.
Annotations 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 {plural_name} are
selected. If a function, it must be a function accepting a single
argument and returning a boolean. The function will be called on
each {singular_name} and those for which the function returned True
will be in the selection.
will be in the selection. If an int N, the Nth {singular_name} matching row
and col will be selected (N can be negative). If a string S, the selector
is equivalent to dict(type=S).
row, col: int or None (default None)
Subplot row and column index of {plural_name} to select.
To select {plural_name} by row and column, the Figure must have been
Expand Down Expand Up @@ -443,15 +445,17 @@ def for_each_{method_prefix}{singular_name}(
----------
fn:
Function that inputs a single {singular_name} object.
selector: dict, function, or None (default None)
selector: dict, function, int, str or None (default None)
Dict to use as selection criteria.
Traces 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 {plural_name} are
selected. If a function, it must be a function accepting a single
argument and returning a boolean. The function will be called on
each {singular_name} and those for which the function returned True
will be in the selection.
will be in the selection. If an int N, the Nth {singular_name} matching row
and col will be selected (N can be negative). If a string S, the selector
is equivalent to dict(type=S).
row, col: int or None (default None)
Subplot row and column index of {plural_name} to select.
To select {plural_name} by row and column, the Figure must have been
Expand Down Expand Up @@ -504,15 +508,17 @@ def update_{method_prefix}{plural_name}(
patch: dict or None (default None)
Dictionary of property updates to be applied to all {plural_name} that
satisfy the selection criteria.
selector: dict, function, or None (default None)
selector: dict, function, int, str or None (default None)
Dict to use as selection criteria.
Traces 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 {plural_name} are
selected. If a function, it must be a function accepting a single
argument and returning a boolean. The function will be called on
each {singular_name} and those for which the function returned True
will be in the selection.
will be in the selection. If an int N, the Nth {singular_name} matching row
and col will be selected (N can be negative). If a string S, the selector
is equivalent to dict(type=S).
row, col: int or None (default None)
Subplot row and column index of {plural_name} to select.
To select {plural_name} by row and column, the Figure must have been
Expand Down
Loading