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] Updated Hatches API page#27370

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

Closed
pat8901 wants to merge5 commits intomatplotlib:mainfrompat8901:main
Closed

Conversation

pat8901
Copy link
Contributor

PR summary

This proposed change aims to address the sparsity of information on the hatches API landing page requested in issue#27196. Currently, users landing on this page may see a lack of information on supported hatches. By enhancing the content and linking to the supported hatches it will make it easier for individuals to quickly locate the information they are seeking.

Ashhar-24 was made co-author of this current PR as I took inspiration from Ashhar-24's PR#27203.

closes#27196

PR checklist

Additional Information

In issue#27196 it is requested for an image to be embedded at the top of the API reference page (via the .. plot:: path/to/image directive). Through testing I am unsure if one can use this directive with a path to an image file. The .. image:: directive may be a better option.

Referencing#27357 andhttps://matplotlib.org/stable/api/sphinxext_plot_directive_api.html I was able to embed the required image using ".. plot::".

In the review please let me know if .. image:: would have been a better choice, and if not, the reasons behind that decision. Your insights will be invaluable for my future pull requests. Thank you.

Co-authored-by: Md Ashhar <mdashhar01@gmail.com>
@story645
Copy link
Member

story645 commentedNov 27, 2023
edited
Loading

through testing I am unsure if one can use this directive with a path to an image file

Yes, and that was my intent with that suggestion. The following should work:

..plot::gallery/shapes_and_collections/hatch_style_reference.py

if it doesn't b/c the example makes too many images then use..image

@pat8901
Copy link
ContributorAuthor

@story645 Yes you are correct using.. plot:: led to too many examples. I opted for.. image:: and changed the code accordingly.
Let me know if there is anything else I need to do. Thank you!

@story645story645 added Documentation: APIfiles in lib/ and doc/api topic: hatch labelsNov 28, 2023
@story645story645 added this to thev3.8-doc milestoneNov 28, 2023
:alt: Example image showing hatching patterns with level 1 density.


For examples using the hatch api refer to: :ref:`sphx_glr_gallery_shapes_and_collections_hatch_style_reference.py`
Copy link
Member

Choose a reason for hiding this comment

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

Looking at the rendered example, jumping into the picture is a bit abrupt so maybe switch- put this as the first sentence, then something introducing the picture (your altext is great)?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

No problem! If I understand correctly makeline 10 come first then have a sentence introducing the example image, possibly the image alt text. Lastly display the image. Is this close to what you want?

Copy link
Member

@story645story645Nov 28, 2023
edited
Loading

Choose a reason for hiding this comment

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

Yup! Exactly

pat8901 reacted with laugh emoji
Copy link
Member

@story645story645 left a comment

Choose a reason for hiding this comment

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

Minor nits but I think almost there.

@@ -2,6 +2,16 @@
``matplotlib.hatch``
********************

For examples using the hatch api refer to: :ref:`sphx_glr_gallery_shapes_and_collections_hatch_style_reference.py`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
For examples using the hatch api refer to::ref:`sphx_glr_gallery_shapes_and_collections_hatch_style_reference.py`
For examples using the hatch api refer to:ref:`sphx_glr_gallery_shapes_and_collections_hatch_style_reference.py`

I don't think it needs the colon?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I agree, I can take it or leave it :) I got rid of it and will submit an update shortly.

@@ -2,6 +2,16 @@
``matplotlib.hatch``
********************

For examples using the hatch api refer to: :ref:`sphx_glr_gallery_shapes_and_collections_hatch_style_reference.py`

Example image showing hatching patterns with level 1 density.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Example image showing hatching patternswith level 1 density.
Example image showingall supportedhatching patternsat level 1 density.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yes! I like that better.

@QuLogic
Copy link
Member

Hmm, should this go here, or in the module description inlib/matplotlib/hatches.py?

@story645
Copy link
Member

Figured here b/c it gets rendered at the top of the reference page & also I thought this sorta thing was the point of the /API pages?

https://output.circle-artifacts.com/output/job/6428217d-4dd4-4c9d-bf62-02905d884afc/artifacts/0/doc/build/html/api/hatch_api.html

@QuLogic
Copy link
Member

The top of that file appears there too; it's the "Contains classes for generating hatch patterns." line.

@story645
Copy link
Member

Yeah I know, what I'm trying to say/ask is why the module page vs the API page since they get rendered together in the docs?

@pat8901
Copy link
ContributorAuthor

@QuLogic@story645 Is there any update on this? Any thing I need to do?

Copy link
Member

@story645story645 left a comment

Choose a reason for hiding this comment

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

Sorry, didn't look at the alt text closely the first time. Otherwise I think it's good.


.. image:: /gallery/shapes_and_collections/images/sphx_glr_hatch_style_reference_001.png
:align: center
:alt: Example image showing all supported hatching patterns at level 1 density.
Copy link
Member

Choose a reason for hiding this comment

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

Sorry I didn't catch this earlier, but I think the alt text here should be more descriptive
" 8 squares, each showing the pattern corresponding to the hatch symbol:
hatch pattern / with square showing right leaning diagonals, \ is left leaning diagonals, | is vertical lines, - is horizontal lines, + is a grid, X is a grid rotated 90 degrees, o is small unfilled circles, O is large unfilled circles, . is small filled circles, and * is 5 point stars

@timhoffm
Copy link
Member

Yeah I know, what I'm trying to say/ask is why the module page vs the API page since they get rendered together in the docs?

We currently don't have a strict policy on this. However, I suggest that we try to keep most API pages free of content, i.e. as thehatches_api.rst has been for now. As long as you only want a short description at the top, that should go into the module docstring. Advantages are:

  • api.rst pages are purely technical definitions of layout. If we want to change that in the future, it's simpler than having to search through content.
  • The content is in one place. You know where to look and there is no danger of duplicate or incongruent content because part is written in the api.rst and part is written in the module docstring (both are rendered in the HTML page).
  • The type of information on top of the API page is exactly what should be in a module docstring. When actually writing it into the module docstring, there's less danger that the API pages grow tutorial style or lengthy examples.

I propose to make the a general rule. Of course, there will be exceptions for a few more involved API pages likehttps://github.com/matplotlib/matplotlib/blob/main/doc/api/axes_api.rst

story645 reacted with thumbs up emoji

@story645
Copy link
Member

propose to make the a general rule.

I'm not opposed/your reasoning makes sense to me, but then I'd like it documented in the "writing docs" section of dev docs if it's gonna be policy.

@story645
Copy link
Member

@pat8901 last steps are

  • move the docs tohatch.py as suggested by@timhoffm
  • consider my suggested alt text

@timhoffm can I spin your comment off into an issue? I'll make sure to put a giant "Not for new contributors" disclaimer.

timhoffm reacted with thumbs up emoji

@story645
Copy link
Member

@pat8901 hi, sorry for the delay, any chance you have bandwith to finish this? otherwise I'll pick it up to finish in a separate commit.

@story645
Copy link
Member

Superceded by#29644 cause this was made to main so I can't push changes, but I kept the authorship from here.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@story645story645story645 requested changes

Assignees
No one assigned
Labels
Documentation: APIfiles in lib/ and doc/apitopic: hatch
Projects
Status: Waiting for author
Milestone
v3.8-doc
Development

Successfully merging this pull request may close these issues.

[Doc]: List supported hatches and link to/embed hatch reference on hatches API page
4 participants
@pat8901@story645@QuLogic@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp