Skip to content
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

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

Merged
merged 3 commits into from
Sep 14, 2016

Conversation

rougier
Copy link
Member

@rougier rougier commented Sep 10, 2016

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

linestyles

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

plt.tight_layout()
# plt.savefig("linestyles.pdf")
Copy link
Member

Choose a reason for hiding this comment

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

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

@NelleV
Copy link
Member

NelleV commented Sep 10, 2016

Thanks again for a very nice addition to the gallery.

@rougier
Copy link
Member Author

rougier commented Sep 10, 2016

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))

@afvincent
Copy link
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
Copy link
Member Author

rougier commented Sep 11, 2016

@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
Copy link
Member Author

rougier commented Sep 11, 2016

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

@tacaswell
Copy link
Member

Line2D.set_dash_capstyle

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

There is also a dash_jointstyle

@tacaswell tacaswell added this to the 2.0 (style change major release) milestone Sep 11, 2016
@rougier
Copy link
Member Author

rougier commented Sep 12, 2016

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

@rougier
Copy link
Member Author

rougier commented Sep 14, 2016

Is there anything else to do with this PR ?

@tacaswell 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)
@tacaswell
Copy link
Member

backported to v2.x as 7ed77e4

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.

None yet

5 participants