Skip to content

prop_cycle breaks keyword aliases #6343

Closed
@lkluft

Description

@lkluft

Debian GNU/Linux 6.0.10 (squeeze) and OSX 10.11.4, Python 3.5.1, matplotlib 1.5.1 (anaconda 4.0.5)

Setting the prop_cycle for an axis breaks the usage of keyword aliases in the plot function. In the following snippets the keyword lw=0.1 is ignored, but linewidth=0.1 produces the wanted result.

Maybe it is worth mentioning that color is still accessible via its alias c after setting a prop_cycle.

If it seems weird to set the prop_cycle to just ignore it: I stumbled across this problem while playing around with stylesheets to set a default cycle through different linestyles. But sometimes you want to explicitly change this behaviour.

fig, ax = plt.subplots()
ax.set_prop_cycle('linewidth', [2, 3, 4])
for c in range(5):
    ax.plot(np.arange(10), c * np.arange(10), lw=0.1)

broken

fig, ax = plt.subplots()
ax.set_prop_cycle('linewidth', [2, 3, 4])
for c in range(5):
    ax.plot(np.arange(10), c * np.arange(10), linewidth=0.1)

working

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions