Install & Compatibility
Where this runs
tested against v0.12.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.012s · 17.8MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.012s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
cycler
✓ from cycler import cycler
Importing the 'cycler' function from the 'cycler' module.
Cycler
✓ from cycler import Cycler
Importing the 'Cycler' class from the 'cycler' module.
This example demonstrates how to use Cycler to create a custom style cycle for plotting multiple sine curves with different colors and line styles.
from cycler import cycler
import matplotlib.pyplot as plt
import numpy as np
# Generate sample data
x = np.linspace(0, 2 * np.pi, 50)
offsets = np.linspace(0, 2 * np.pi, 4, endpoint=False)
yy = np.transpose([np.sin(x + phi) for phi in offsets])
# Create a cycler object
style_cycler = cycler(color=['r', 'g', 'b', 'c'], linestyle=['-', '--', '-.'])
# Apply the cycler to the current axes
plt.gca().set_prop_cycle(style_cycler)
# Plot the data
for y in yy:
plt.plot(x, y)
plt.show()
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'cycler'
The `cycler` package is not installed in the Python environment, or the environment where it's installed is not the one being used.
fixInstall the `cycler` library using pip: `pip install cycler`
AttributeError: 'Cycler' object has no attribute 'change_key'
This error typically occurs when an older version of the `cycler` library is used with a newer version of `matplotlib` that expects a method (`change_key`) which is not present in the older `cycler` version.
fixUpgrade the `cycler` library to its latest version: `pip install --upgrade cycler`
NameError: name 'cycler' is not defined
The `cycler` object or class was used in a context (e.g., `matplotlib.rcParams`) without being explicitly imported from the `cycler` module.
fixAdd `from cycler import cycler` at the top of your Python script or relevant code block.
ImportError: cannot import name 'Cycler' from 'cycler'
This usually indicates a version mismatch where the `Cycler` class might not be directly exposed at the top level of the `cycler` package in older versions, or there's a conflict with other installed packages.
fixEnsure `cycler` is up-to-date: `pip install --upgrade cycler`. If the issue persists, try importing `cycler` as a module and accessing its attributes: `import cycler` then `cycler.Cycler()`.
Upgrade
Version history
0.12.1latest on PyPI · released Oct 7, 2023
Audit
Dependencies
matplotlibrequiredCycler is a dependency of Matplotlib, a popular plotting library.