FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[DOC] Example of user-defined linestyle (TikZ linestyle) by rougier · Pull Request #7087 · matplotlib/matplotlib · GitHub

Repository navigation

[DOC] Example of user-defined linestyle (TikZ linestyle) - #7087

Merged
tacaswell merged 3 commits into
matplotlib:masterfrom
rougier:linestyle
Sep 14, 2016
Merged

tacaswell merged 3 commits into
matplotlib:masterfrom
rougier:linestyle

Conversation

rougier commented Sep 10, 2016

Copy link
Copy Markdown
Member

This is an example showing user-defined linestyle copying name and style of TikZ.

color="blue", family="monospace")

plt.tight_layout()
# plt.savefig("linestyles.pdf")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'd remove those two lines, thought I honestly don't have a strong feeling about it.

NelleV commented Sep 10, 2016

Copy link
Copy Markdown
Member

Thanks again for a very nice addition to the gallery.

rougier commented Sep 10, 2016 •
edited
Loading

Copy link
Copy Markdown
Member Author

This could be the base for new linestyles (MEP ?):

Name Linestyle Value
- Solid (0, ())
.:dense Densely dotted (0, (1, 1))
.:normal or . Dotted (0, (1, 5))
.:loose Loosely dotted (0, (1, 10))
--:dense Densely dashed (0, (5, 1))
--:normal or -- Dashed (0, (5, 5))
--:loose Loosely dashed (0, (5, 10))
-.:dense Densely dashdotted (0, (3, 1, 1, 1))
-.:normal or -. Dashdotted (0, (3, 5, 1, 5))
-.:loose Loosely dashdotted (0, (3, 10, 1, 10))
-..:dense Densely Dashdotdotted (0, (3, 1, 1, 1, 1, 1))
-..:normal or -.. Dashdotdotted (0, (3, 5, 1, 5, 1, 5))
-..:loose Loosely Dashdotdotted (0, (3, 10, 1, 10, 1, 10))

Copy link
Copy Markdown
Contributor

I mention this just in case: there was some discussion related to line style patterns in #6547 a while ago, and the values that were chosen for the '-', ':' and '-.' line styles are a bit different.

Personally, I think it may be a good idea to add some extra default line styles like this PR suggest. Quite often, I wish there was (at least) a "dashdotdotted" style available.

About the example, I would have 2 remarks:

  • it might be confusing to use the names "dotted", "dashdotted" and "dashed" for styles that do not use the default values.
  • is it necessary to use plt.xticksand plt.yticks instead of the OO methods ax.set_xticks and ax.set_yticks?

Apart from these, I find the example to be very nice, as it may provide to the users some ready-to-use values for line style patterns, without having them to try a bunch of values on their own (like I often did...)

rougier commented Sep 11, 2016

Copy link
Copy Markdown
Member Author

@afvincent Thanks for the review.

  1. The names come from TikZ actually.
  2. No reason to use plt.xticks, I need to change that.
  3. Dotted /dashed: I didn't know what are the default values so I tried to guess them

Also thanks for the link to the PR. Do you now if there's a way to have round caps in 2.0 ?

rougier commented Sep 11, 2016

Copy link
Copy Markdown
Member Author

Actually it doesn't work with ax.set_yaxis()

Copy link
Copy Markdown
Member

Line2D.set_dash_capstyle

http://matplotlib.org/api/lines_api.html#module-matplotlib.lines

There is also a dash_jointstyle

tacaswell added this to the 2.0 (style change major release) milestone Sep 11, 2016

rougier commented Sep 12, 2016

Copy link
Copy Markdown
Member Author

@tacaswell Thanks. I would (personally) prefer round caps by defaults but I imagine it has been already discussed.

rougier commented Sep 14, 2016

Copy link
Copy Markdown
Member Author

Is there anything else to do with this PR ?

tacaswell merged commit 5fb331b into matplotlib:master Sep 14, 2016
tacaswell added a commit that referenced this pull request Sep 14, 2016
DOC: Example of user-defined linestyle (TikZ linestyle)

Copy link
Copy Markdown
Member

backported to v2.x as 7ed77e4

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL