Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/python/plotly/plotly/basedatatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ def select_traces(self, selector=None, row=None, col=None, secondary_y=None):
Generator that iterates through all of the traces that satisfy
all of the specified selection criteria
"""
if not selector:
if not selector and not isinstance(selector, int):
selector = {}

if row is not None or col is not None or secondary_y is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,10 @@ def select_traces_fixture():

def test_select_traces_integer(select_traces_fixture):
fig = select_traces_fixture
# check that selecting first trace does indeed only select the first
tr = list(fig.select_traces(selector=0))
assert len(tr) == 1
assert tr[0].y[1] == 0
# check we can index last trace selected
tr = list(fig.select_traces(selector=-1))[0]
assert tr.y[1] == 20
Expand Down