Skip to content

[ENH]: set default color cycle to named color sequence #29799

Closed

Description

@rcomer

Problem

It would be great if I could put something like this in my matplotlibrc to use the petroff10 color sequence by default:

axes.prop_cycle : cycler('color', 'petroff10')

Proposed solution

Currently if a single string is supplied we try to interpret as a list of single character colors

if allow_stringlist:
# Sometimes, a list of colors might be a single string
# of single-letter colornames. So give that a shot.
val = [scalar_validator(v.strip()) for v in s if v.strip()]

None of the current built in color sequences can be interpreted that way, so it would not be ambiguous to try both that and querying the color sequence registry. However, maybe we would need something to guard against user- or third-party-defined color sequences having a name like "rygbk"?

Activity

  1. story645 commented on Mar 24, 2025

    @story645
    Member

    However, maybe we would need something to guard against user- or third-party-defined color sequences having a name like "rygbk"?

    Wouldn't query registry first, fallback to parse as sequence do the trick?

  2. rcomer commented on Mar 24, 2025

    @rcomer
    MemberAuthor

    @story645 that seems reasonable to me. If there is ambiguity, we can just declare "this takes precedence".

  3. added this to the v3.11.0 milestone on Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions