Skip to content

About linestyles: tuple not accepted in rc param file and other inconsistencies #11797

@ImportanceOfBeingErnest

Description

This is related to #8040 and #9797, possibly #7219.

Bug report

Apart from strings like "-", "--", ":" , the linestyle can also be set as a tuple of an on/off sequence. There are however two different notations,

  • (on, off, on, off, ...) and
  • (start, (on, off, on, off, ...)).

For all of the ways to set the linestyle, only one or none of those actually work.

Most importantly there is currently no way to set an on/off linestyle via the rc file.


The following lists those combinations and whether they work or not with the respective commands.

linestyle /dashes inside plot function

command working
plt.plot([1,2], linestyle=":") ✔️
plt.plot([1,2], linestyle=(5,1,1,1))
plt.plot([1,2], linestyle=(0,(5,1,1,1))) ✔️
plt.plot([1,2], dashes=":")
plt.plot([1,2], dashes=(5,1,1,1)) ✔️
plt.plot([1,2], dashes=(0, (5,1,1,1)))

using rcParams

command working
plt.rcParams["grid.linestyle"] = ":" ✔️
plt.rcParams["grid.linestyle"] = (5,1,1,1) ✔️
plt.rcParams["grid.linestyle"] = (0,(5,1,1,1))

inside cycler using rcParams

command working
plt.rcParams["axes.prop_cycle"] += plt.cycler("linestyle", [":"]) ✔️
plt.rcParams["axes.prop_cycle"] += plt.cycler("linestyle", [(5,1,1,1)])
plt.rcParams["axes.prop_cycle"] += plt.cycler("linestyle", [(0,(5,1,1,1))]) ✔️

using rc file

command working
grid.linestyle : : ✔️
grid.linestyle : (5,1,1,1)
grid.linestyle : (0,(5,1,1,1))

inside cycler using rc file

command working
axes.prop_cycle : cycler("linestyle", [":"] ) ✔️
axes.prop_cycle : cycler("linestyle", [(5,1,1,1)] )
axes.prop_cycle : cycler("linestyle", [(0,(5,1,1,1))] )

Correlation

command string ":" tuple (5,1,1,1) tuple (0,(5,1,1,1))
plt.plot(..., linestyle=x) ✔️ ✔️
plt.plot(..., dashes=x) ✔️
plt.rcParams["grid.linestyle"] = x ✔️ ✔️
plt.rcParams["axes.prop_cycle"] += plt.cycler("linestyle", [x]) ✔️ ✔️
rc file grid.linestyle : x ✔️
rc file axes.prop_cycle : cycler("linestyle", [x] ) ✔️

I think the first thing to do here is to identify which combinations should actually work.

attn. @afvincent who has last worked on validation of linestyle rc Parameters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: consistencyGood first issueOpen a pull request against these issues if there are no active ones!keepItems to be ignored by the “Stale” Github Actiontopic: rcparams

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy