Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ImportanceOfBeingErnest opened this issue Jul 29, 2018 · 6 comments
Labels
API: consistency Good first issue Open a pull request against these issues if there are no active ones! keep Items to be ignored by the “Stale” Github Action topic: rcparams

Comments

@ImportanceOfBeingErnest
Copy link
Member

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.

@anntzer
Copy link
Contributor

anntzer commented Jan 21, 2020

Many cases (not all) were fixed by #15827.

@QuLogic QuLogic modified the milestones: v3.3.0, v3.4.0 May 7, 2020
@QuLogic QuLogic modified the milestones: v3.4.0, v3.5.0 Jan 27, 2021
@QuLogic QuLogic modified the milestones: v3.5.0, v3.6.0 Sep 25, 2021
@QuLogic QuLogic modified the milestones: v3.6.0, v3.7.0 Aug 24, 2022
@ksunden ksunden modified the milestones: v3.7.0, v3.7.1 Feb 14, 2023
@QuLogic QuLogic modified the milestones: v3.7.1, future releases Mar 4, 2023
Copy link

This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Aug 16, 2024
@timhoffm
Copy link
Member

To move forward or close this, it would be good to recreate the initial tables on what works and what not with the current version of matplotlib.

I'm marking this as good first issue for recreating the tables. Further actions will need to be discussed on the result.

@timhoffm timhoffm added the Good first issue Open a pull request against these issues if there are no active ones! label Aug 21, 2024
Copy link

Good first issue - notes for new contributors

This issue is suited to new contributors because it does not require understanding of the
Matplotlib internals. To get started, please see our contributing
guide
.

We do not assign issues. Check the Development section in the sidebar for linked pull
requests (PRs). If there are none, feel free to start working on it. If there is an open PR, please
collaborate on the work by reviewing it rather than duplicating it in a competing PR.

If something is unclear, please reach out on any of our communication
channels
.

@timhoffm
Copy link
Member

As good first issue: It would be good to recreate the initial tables on what works and what not with the current version of matplotlib.

@story645 story645 added keep Items to be ignored by the “Stale” Github Action and removed status: inactive Marked by the “Stale” Github Action labels Aug 21, 2024
@QuLogic
Copy link
Member

QuLogic commented Aug 31, 2024

I thought @oscargus looked into this wrt dashes and linestyles?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: consistency Good first issue Open a pull request against these issues if there are no active ones! keep Items to be ignored by the “Stale” Github Action topic: rcparams
Projects
None yet
Development

No branches or pull requests

8 participants