10000 [Bug]: axes.prop_cycle behavior change · Issue #29915 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
[Bug]: axes.prop_cycle behavior change #29915
Open
@larsoner

Description

@larsoner

PR #29808 (identified by git bisect) changed the behavior of:

$ python -c 'import matplotlib; print(matplotlib.rcParams.get("axes.prop_cycle").by_key()["color"])'
['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf']

to now be a list of tuple of float rather than a list of str:

$ python -c 'import matplotlib; print(matplotlib.rcParams.get("axes.prop_cycle").by_key()["color"])'
[(0.12156862745098039, 0.4666666666666667, 0.7058823529411765), (1.0, 0.4980392156862745, 0.054901960784313725), (0.17254901960784313, 0.6274509803921569, 0.17254901960784313), (0.8392156862745098, 0.15294117647058825, 0.1568627450980392), (0.5803921568627451, 0.403921568627451, 0.7411764705882353), (0.5490196078431373, 0.33725490196078434, 0.29411764705882354), (0.8901960784313725, 0.4666666666666667, 0.7607843137254902), (0.4980392156862745, 0.4980392156862745, 0.4980392156862745), (0.7372549019607844, 0.7411764705882353, 0.13333333333333333), (0.09019607843137255, 0.7450980392156863, 0.8117647058823529)]

This is potentially problematic for end-users. MNE-Python we know the default prop_cycle (and everyone seems to use it!) so make use of the fact that we know #7f7f7f is in there, remove it, and create a new cycle. Our code now breaks with:

    self.color_list.remove("#7f7f7f")
ValueError: list.remove(x): x not in list

And yes we should make our check better (e.g., remove any color sufficiently close to the bad color, etc.) but it seems like a potential regression that this behavior has changed in any case. Feel free to close if not!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0