Open
Description
It would be useful to add __getitem__
functionality to cycler
.
The use case is a "crowded" for loop where you want to get the cycler style without using a loop variable. Something like:
data_cycler = cycler('alpha', (0.2, 0.4, 0.6)) + cycler('color', ('r', 'g', 'b'))
fit_cycler = cycler('color', ('k', 'm', 'orange'))
for i, (data, fit) in enumerate(zip(data_list, fit_list)):
...
plt.plot('x', 'y', data=data, data_cycler[i])
plt.plot('x', 'y', data=data, fit_cycler[i])
...
In this case the index i
is computed anyway, so using it for the cyclers would be handy, instead of adding the cycler inside zip()
.
Ideally mycycler[i]
should return the item with index i % len(mycycler)
.
I haven't looked at the code yet. Would this be possible? Would a PR be welcome?
Metadata
Metadata
Assignees
Labels
No labels