Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DOC: correct linestyle example and reference rcParams#28971

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 1 commit intomatplotlib:mainfromrcomer:linestyles
Oct 14, 2024

Conversation

rcomer
Copy link
Member

PR summary

Today I had reason to want to know exactly what the "dotted" pattern is and thought this example could have been more helpful. So I

  • added a sentence about configuration byrcParams
  • removed the statement that "dotted" is the same as the pattern (1, 1), since the default rcParam for that is (1, 1.65)
  • in the tuple examples, increased the spacing for "dotted" as it was identical to "densely dotted". I picked 5 to be consistent with the other examples that are not "densely" or "loosely".

PR checklist

@github-actionsgithub-actionsbot added the Documentation: examplesfiles in galleries/examples labelOct 11, 2024
@rcomer
Copy link
MemberAuthor

Renders like this

See also `.Line2D.set_linestyle`.
See also `.Line2D.set_linestyle`. The specific on off sequence of the
"dotted", "dashed" and "dashdot" styles may be configured using
``rcParams["lines.{style}_pattern"]``.
Copy link
Member

Choose a reason for hiding this comment

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

The f-string replacer here is a little mysterious - maybe add an example?

Suggested change
``rcParams["lines.{style}_pattern"]``.
``rcParams["lines.{style}_pattern"]``,eg.`rcParams["lines.dotted_pattern"] = (0, (1, 10))`.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

What do you think about listing them all out with the:rc: directive? I quite like that we can see the defaults for free, but not sure if it's just too much...

Copy link
Member

Choose a reason for hiding this comment

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

sure, explicit is probably fine.

@rcomerrcomerforce-pushed thelinestyles branch 2 times, most recently from536cac4 to368cb39CompareOctober 11, 2024 19:52
@rcomerrcomer marked this pull request as draftOctober 11, 2024 20:01
@rcomerrcomer marked this pull request as ready for reviewOctober 11, 2024 20:37
@rcomer
Copy link
MemberAuthor

Current iteration

@timhoffm
Copy link
Member

The names and original pattern values are taken over from TikZ in#7087. That somehow got lost in#12586. But I suggest that we keepthese relations and possibly also mention that again.

@QuLogic
Copy link
Member

QuLogic commentedOct 11, 2024
edited
Loading

While you're here, can you shrink the figure width to under 7 inches? It is currently being scaled down to fit the page content width, which doesn't look good, and I don't see any reason it needs to be this wide specifically.

Possibly addlayout='constrained' and then the whitespace on the right will be trimmed, so it will look a similar size as before.

@timhoffm
Copy link
Member

I don't see any reason it needs to be this wide specifically.

Pydata-sphinx-theme has a smaller main content width than our previous website layout. There may well be a number of figures that don't fit anymore.

@QuLogic
Copy link
Member

So I double checked on a wide image and the width is actually 896px, which at 100 dpi is just under 9 inches, so it shouldn't be too much different with constrained layout on.

I also went through our sphinx gallery results, and we have 76 images over the limit.

@jklymak
Copy link
Member

I think sometimes it's fine to shrink an image. Usually instead of shrinking all the fonts and linewidths. In this case I'm sure the figure could simply be smaller.

@rcomer
Copy link
MemberAuthor

rcomer commentedOct 12, 2024
edited
Loading

@timhoffm AFAICS the patterns we currently have here still match#7087, but not what is given in that StackExchange answer.I note#7087 is newer than the SE answer, so maybe TikZ changed?

Edit: I found my local file, which seems to match the SE answer.

\tikzset{solid/.style=                   {dash pattern=}}%\tikzset{dotted/.style=                  {dash pattern=on \pgflinewidth off 2pt}}%\tikzset{densely dotted/.style=          {dash pattern=on \pgflinewidth off 1pt}}%\tikzset{loosely dotted/.style=          {dash pattern=on \pgflinewidth off 4pt}}%\tikzset{dashed/.style=                  {dash pattern=on 3pt off 3pt}}%\tikzset{densely dashed/.style=          {dash pattern=on 3pt off 2pt}}%\tikzset{loosely dashed/.style=          {dash pattern=on 3pt off 6pt}}%\tikzset{dashdotted/.style=              {dash pattern=on 3pt off 2pt on \the\pgflinewidth off 2pt}}%\tikzset{dash dot/.style=                {dash pattern=on 3pt off 2pt on \the\pgflinewidth off 2pt}}%\tikzset{densely dashdotted/.style=      {dash pattern=on 3pt off 1pt on \the\pgflinewidth off 1pt}}%\tikzset{densely dash dot/.style=        {dash pattern=on 3pt off 1pt on \the\pgflinewidth off 1pt}}%\tikzset{loosely dashdotted/.style=      {dash pattern=on 3pt off 4pt on \the\pgflinewidth off 4pt}}%\tikzset{loosely dash dot/.style=        {dash pattern=on 3pt off 4pt on \the\pgflinewidth off 4pt}}%\tikzset{dashdotdotted/.style=           {dash pattern=on 3pt off 2pt on \the\pgflinewidth off 2pt on \the\pgflinewidth off 2pt}}%\tikzset{densely dashdotdotted/.style=   {dash pattern=on 3pt off 1pt on \the\pgflinewidth off 1pt on \the\pgflinewidth off 1pt}}%\tikzset{loosely dashdotdotted/.style=   {dash pattern=on 3pt off 4pt on \the\pgflinewidth off 4pt on \the\pgflinewidth off 4pt}}%\tikzset{dash dot dot/.style=         {dash pattern=on 3pt off 2pt on \the\pgflinewidth off 2pt on \the\pgflinewidth off 2pt}}%\tikzset{densely dash dot dot/.style=   {dash pattern=on 3pt off 1pt on \the\pgflinewidth off 1pt on \the\pgflinewidth off 1pt}}%\tikzset{loosely dash dot dot/.style=   {dash pattern=on 3pt off 4pt on \the\pgflinewidth off 4pt on \the\pgflinewidth off 4pt}}%

@rcomer
Copy link
MemberAuthor

rcomer commentedOct 12, 2024
edited
Loading

7 inch version

@timhoffm
Copy link
Member

I find it somewhat confusing that the names under "named line styles" are repeated in the "parametrized linestyles " but have different patterns.Obviously, we cannot change the patterns for the matplotlib names. If they are different to the tikz patterns, we should clearly communicate that the above are Matplotlib named linestyles and that the pattern section are examples to reproduce the tikz linestyles.

@rcomer
Copy link
MemberAuthor

rcomer commentedOct 14, 2024
edited
Loading

As I understand it, we specify our dash lengths in multiples of linewidth whereas Tikz specifies dash length in points (with only "dot" specified as linewidth). So we can only go so far to match the Tikz styles. We could put the Tikz numbers in and say these are "adapted from Tikz styles"?

Edit: though we also have "long dash with offset" which was added more recently and has nothing to do with Tikz.

@rcomer
Copy link
MemberAuthor

If the repeated name is the issue, we could also just update the parametrized "dotted" to e.g. "medium dotted".

Copy link
Member

@timhoffmtimhoffm left a comment

Choose a reason for hiding this comment

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

Ok, let's not overthink this. We can still improve later.

rcomer reacted with thumbs up emoji
@timhoffmtimhoffm added this to thev3.10.0 milestoneOct 14, 2024
@timhoffmtimhoffm merged commit9f8eeba intomatplotlib:mainOct 14, 2024
22 checks passed
@rcomerrcomer deleted the linestyles branchOctober 14, 2024 13:13
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jklymakjklymakjklymak left review comments

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Labels
Documentation: examplesfiles in galleries/examples
Projects
None yet
Milestone
v3.10.0
Development

Successfully merging this pull request may close these issues.

4 participants
@rcomer@timhoffm@QuLogic@jklymak

[8]ページ先頭

©2009-2025 Movatter.jp