10000 [Bug]: Default plot color cycler · Issue #24452 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
[Bug]: Default plot color cycler #24452
Closed
@ghost

Description

Bug summary

When updating from version 3.5.0 to 3.6.2, the default plot color cycler changed and there's no documentation indicating it should have.

Code for reproduction

import matplotlib.pyplot as plt
plt.style.use('_mpl-gallery')
fig, ax = plt.subplots()
for num in [1, 2, 3, 4]:
    ax.plot(0, num, 'o')

plt.show()

Actual outcome

image

Expected outcome

image

Additional information

Documentation says that the default cycler should be:

('color', ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'])

It displays expected colors in version 3.5.0, but not in version 3.6.2.

Found fix:

import matplotlib as mpl
from cycler import cycler
mpl.rcParams['axes.prop_cycle'] = cycler('color', [ '#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'])

But that should not be necessary as that should be the default

Operating system

Ubuntu

Matplotlib Version

3.6.2

Matplotlib Backend

No response

Python version

3.8.10

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0