Skip to content
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

[feature-request] addition of cyclers requires them to be equal length #51

Closed
bjmuld opened this issue Jan 14, 2019 · 1 comment
Closed

Comments

@bjmuld
Copy link

bjmuld commented Jan 14, 2019

I often need to combine cyclers of unequal length. I had been under the impression that the salient feature distinguishing the '*' and '+' operations was whether or not the cyclers being joined were of equal length, but after submitting matplotlib/cycler #50, it seems that '*' is intended to combine them in a hierarchical fashion, where '+' yields simultaneous cycling.

Currently, '+' does not support unequal-length cyclers, leaving the user to solve the problem of finding the LCM of the two cyclers and extending their length appropriately. Though not insurmountable, it's a significant distraction from other work.

Thoughts?

from matplotlib.pyplot import cycler

prop_orders = {
    'color': ['k', 'r', 'g', 'b', 'c', 'm', 'y'],
    'marker': ['.', 'o', 'v', 's', '*'],
}

a=cycler('color', prop_orders['color'])
b=cycler('marker', prop_orders['marker'])

c = (a*b)()

print(next(c))
print(next(c))

Actual outcome

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "", line 242, in __add__
    "not {0} and {1}".format(len(self), len(other)))
ValueError: Can only add equal length cycles, not 7 and 5

Desired outcome
I would hope for the operation to succeed and for both attributes to be actively cycling, i.e.

{'color': 'k', 'marker': '.'}
{'color': 'r', 'marker': 'o'}
@bjmuld
Copy link
Author

bjmuld commented Jan 14, 2019

duplicate :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants