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: 2 additions & 0 deletions ultraplot/axes/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2485,6 +2485,8 @@ def _parse_cycle(
resolved_cycle = None
case str() | int():
resolved_cycle = constructor.Cycle(cycle, **cycle_kw)
case constructor.Cycle():
resolved_cycle = constructor.Cycle(cycle)
case _:
resolved_cycle = None

Expand Down
11 changes: 11 additions & 0 deletions ultraplot/tests/test_constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,14 @@ def test_manual_cycle():
props = ax._active_cycle.get_next()
assert cycled_pos == parser._idx
assert props == parser._cycler_items[parser._idx]


def test_pass_on_cycle():
colors = ["red", "green", "black"]
cycle = uplt.Cycle(colors)
fig, ax = uplt.subplots()
ax.set_prop_cycle(cycle)
active_cycle = ax.axes._active_cycle
for color in colors:
assert color == active_cycle.get_next()["color"]
assert color == cycle.get_next()["color"]
Loading