Create a `~cycler.Cycler` object much like :func:`cycler.cycler`, but includes input validation. Call signatures:: cycler(cycler) cycler(label=values, label2=values2, ...) cycler(label, values) Form 1 copies a given `~cycler.Cycler` object. Form 2 creates a
(*args, **kwargs)
| 731 | |
| 732 | |
| 733 | def cycler(*args, **kwargs): |
| 734 | """ |
| 735 | Create a `~cycler.Cycler` object much like :func:`cycler.cycler`, |
| 736 | but includes input validation. |
| 737 | |
| 738 | Call signatures:: |
| 739 | |
| 740 | cycler(cycler) |
| 741 | cycler(label=values, label2=values2, ...) |
| 742 | cycler(label, values) |
| 743 | |
| 744 | Form 1 copies a given `~cycler.Cycler` object. |
| 745 | |
| 746 | Form 2 creates a `~cycler.Cycler` which cycles over one or more |
| 747 | properties simultaneously. If multiple properties are given, their |
| 748 | value lists must have the same length. |
| 749 | |
| 750 | Form 3 creates a `~cycler.Cycler` for a single property. This form |
| 751 | exists for compatibility with the original cycler. Its use is |
| 752 | discouraged in favor of the kwarg form, i.e. ``cycler(label=values)``. |
| 753 | |
| 754 | Parameters |
| 755 | ---------- |
| 756 | cycler : Cycler |
| 757 | Copy constructor for Cycler. |
| 758 | |
| 759 | label : str |
| 760 | The property key. Must be a valid `.Artist` property. |
| 761 | For example, 'color' or 'linestyle'. Aliases are allowed, |
| 762 | such as 'c' for 'color' and 'lw' for 'linewidth'. |
| 763 | |
| 764 | values : iterable |
| 765 | Finite-length iterable of the property values. These values |
| 766 | are validated and will raise a ValueError if invalid. |
| 767 | |
| 768 | Returns |
| 769 | ------- |
| 770 | Cycler |
| 771 | A new :class:`~cycler.Cycler` for the given properties. |
| 772 | |
| 773 | Examples |
| 774 | -------- |
| 775 | Creating a cycler for a single property: |
| 776 | |
| 777 | >>> c = cycler(color=['red', 'green', 'blue']) |
| 778 | |
| 779 | Creating a cycler for simultaneously cycling over multiple properties |
| 780 | (e.g. red circle, green plus, blue cross): |
| 781 | |
| 782 | >>> c = cycler(color=['red', 'green', 'blue'], |
| 783 | ... marker=['o', '+', 'x']) |
| 784 | |
| 785 | """ |
| 786 | if args and kwargs: |
| 787 | raise TypeError("cycler() can only accept positional OR keyword " |
| 788 | "arguments -- not both.") |
| 789 | elif not args and not kwargs: |
| 790 | raise TypeError("cycler() must have positional OR keyword arguments") |
searching dependent graphs…