-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: Md Ashhar <mdashhar01@gmail.com>
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 |
@story645 Yes you are correct using |
doc/api/hatch_api.rst
Outdated
: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` |
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
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 make line 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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup! Exactly
There was a problem hiding this 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.
doc/api/hatch_api.rst
Outdated
@@ -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` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
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.
doc/api/hatch_api.rst
Outdated
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example image showing hatching patterns with level 1 density. | |
Example image showing all supported hatching patterns at level 1 density. |
There was a problem hiding this comment.
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.
Hmm, should this go here, or in the module description in |
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? |
The top of that file appears there too; it's the "Contains classes for generating hatch patterns." line. |
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? |
There was a problem hiding this 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. |
There was a problem hiding this comment.
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
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 the
I propose to make the a general rule. Of course, there will be exceptions for a few more involved API pages like https://github.com/matplotlib/matplotlib/blob/main/doc/api/axes_api.rst |
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. |
@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. |
Superceded by #29644 cause this was made to main so I can't push changes, but I kept the authorship from here. |
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 and https://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.