Skip to content

There is no set_linestyle_cycle in the matplotlib axes API #2841

Closed

Description

@rubenvb

It would be useful to have an API to set the linestyle cycle for an axes object, just like there is one for the color cycle. It would allow one to change linestyles independently of the color, which is useful for publications that need both color and black-and-white distinguishability.

Activity

  1. added this to the v1.4.0 milestone on Feb 25, 2014
  2. WeatherGod commented on Feb 25, 2014

    @WeatherGod
    Member

    This has long been a wish of mine, and I have tinkered with a more
    generalized mechanism for cycling all sorts of properties. Unfortunately, I
    ran out of time and resources to really get this working back in the day. I
    wanted to cycle not just colors and linesyles, but also markers,
    linewidths, hatching (for histograms, for example)... anything really.

    The trouble was immediately apparent with how crusty the current color
    cycling mechanism is. Internally, there are actually two (or three?) color
    cycles, one for scatter and one for line plots. This way, if someone does a
    scatter plot, and then does a line plot, under most use-cases, the
    "correct" color appears. I think the same thing happens for doing
    histograms or bar charts with plot() (so that would be 3 color cycles!).

    So, for such a huge scope that I envisioned, one can see how badly that
    would turn out...

    If I ever have any time at all to work on matplotlib again, it would be
    this feature that I would refactor so that this could be implemented.

    On Tue, Feb 25, 2014 at 9:50 AM, Ruben Van Boxem
    notifications@github.comwrote:

    It would be useful to have an API to set the linestyle cycle for an axes
    object, just like there is one for the color cycle. It would allow one to
    change linestyles independently of the color, which is useful for
    publications that need both color and black-and-white distinguishability.

    Reply to this email directly or view it on GitHubhttps://github.com//issues/2841
    .

  3. tacaswell commented on Feb 26, 2014

    @tacaswell
    Member

    I thought this would be a quick fix, but given @WeatherGod 's comments, re-milestoning this for 1.5 + wishlist

  4. modified the milestones: , v1.4.0 on Feb 26, 2014
  5. mrkrd commented on Nov 12, 2014

    @mrkrd

    That would be a very useful feature. Thank you!

  6. WeatherGod commented on Nov 19, 2014

    @WeatherGod
    Member

    Out-of-the-blue thread-rezzin'

    I think it is time to stop letting perfection be the enemy of
    "good-enough"... it should be fairly trivial to duplicate the color cycle
    stuff and use it the same way...

    I think I'll pull together a PR for this tonight.

    On Wed, Nov 12, 2014 at 2:27 PM, mrkrd notifications@github.com wrote:

    That would be a very useful feature. Thank you!

    —
    Reply to this email directly or view it on GitHub
    #2841 (comment)
    .

  7. TorbjornT commented on Jan 11, 2016

    @TorbjornT

    I guess the new prop_cycler in 1.5 solves this?

  8. tacaswell commented on Jan 11, 2016

    @tacaswell
    Member

    Yes, that was the intention. I think this is safe to close as completed.

    ax.set_prop_cycle('ls', ['-', '--', ':'])

    Is the minimal example to cycle only the line style.

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