Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC: use minigallery for tutorial thumbnails#31275

Merged
QuLogic merged 19 commits intomatplotlib:mainfrom
MohitPal2005:fix-issue-name
Apr 10, 2026
Merged

DOC: use minigallery for tutorial thumbnails#31275
QuLogic merged 19 commits intomatplotlib:mainfrom
MohitPal2005:fix-issue-name

Conversation

@MohitPal2005
Copy link
Copy Markdown
Contributor

@MohitPal2005 MohitPal2005 commented Mar 11, 2026

PR summary

This simplifies the reST by removing several manually-written HTML raw blocks.

AI Disclosure

AI tools were used for guidance on Git workflow and understanding
the repository structure. The code change itself was written
and verified manually.

@github-actions
Copy link
Copy Markdown

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join us on gitter for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide.
Please let us know if (and how) you use AI, it will help us give you better feedback on your PR.

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@story645
Copy link
Copy Markdown
Member

story645 commented Mar 11, 2026

Thanks for the PR, but tutorials don't have thumbnails b/c of the way the index page is written for tutorials. The solution for tutorials is to use the sphinx minigallery directive to grab the tutorial files, which may include a reorg of the tutorials landing page.

@MohitPal2005
Copy link
Copy Markdown
Contributor Author

Thank you for the clarification!

I understand that tutorials use a different mechanism and that the correct
solution is to use the sphinx minigallery directive instead of
sphinx_gallery_thumbnail_number.

I will look into the tutorials landing page and explore how the
minigallery directive can be used to properly generate thumbnails.

Please let me know if there are specific files or examples I should start with.

@melissawm melissawm moved this to Waiting for author in First Time Contributors Mar 11, 2026
@story645 story645 marked this pull request as draft March 11, 2026 15:37
@story645 story645 marked this pull request as draft March 11, 2026 15:37
@MohitPal2005 MohitPal2005 marked this pull request as ready for review March 12, 2026 22:53
@MohitPal2005
Copy link
Copy Markdown
Contributor Author

Thank you for the guidance! I have removed the thumbnail variable from the Python script and successfully added the minigallery directive to the tutorial's index.rst landing page as requested.

@melissawm melissawm moved this from Waiting for author to Needs review in First Time Contributors Mar 13, 2026
@story645
Copy link
Copy Markdown
Member

This PR yields a page that looks exactly like the current tutorial landing page https://matplotlib.org/devdocs/tutorials/index.html

But also I don't think this is the right approach. I think if we were gonna add thumbnails to tutorials, the page should be restructured to use the minigallery directive to show thumbnails under each header.

@MohitPal2005
Copy link
Copy Markdown
Contributor Author

Hi @story645, thank you so much for the review and the architectural direction!

I completely agree that restructuring the page to use the minigallery directive under each specific header will make the tutorial landing page much more visually useful. I will pivot my approach, restructure the index.rst file as you suggested, and push an updated commit shortly.

@story645
Copy link
Copy Markdown
Member

story645 commented Mar 18, 2026

restructure the index.rst file

What is your plan here? Your comments concern me a bit b/c they're mirroring mine but not really engaging w/ the contents.

@MohitPal2005
Copy link
Copy Markdown
Contributor Author

Thanks for pointing that out — that’s helpful.

Here’s what I’m thinking for the page:

  • I’ll split the tutorials into sections based on how they’re already grouped (like more introductory vs more specific topics), instead of keeping everything in one list.
  • Under each section, I’ll add a .. minigallery:: so each group shows its own thumbnails.
  • I’ll keep the existing toctree (probably hidden) so navigation doesn’t break, but the visible page will be driven by these section-wise galleries.

So the idea is not just adding thumbnails, but actually changing how the page is structured.

I’ll try this locally and push an update so we can see how it looks.

@melissawm melissawm moved this from Needs review to Waiting for author in First Time Contributors Mar 18, 2026
@story645 story645 marked this pull request as draft March 18, 2026 15:20
@story645
Copy link
Copy Markdown
Member

putting to draft until the docs build well enough to show the proposal - also please update the PR title to what this PR is doing now.

@MohitPal2005 MohitPal2005 marked this pull request as ready for review March 18, 2026 20:40
@story645
Copy link
Copy Markdown
Member

story645 commented Mar 18, 2026

I think this needs some feedback from other maintainers too, but I think using the sphinx gallery machinery is an improvement over hardcoding the html:
https://output.circle-artifacts.com/output/job/d6c63851-f51d-42ef-ab79-3b17f7f68e21/artifacts/0/doc/build/html/tutorials/index.html

image

@story645 story645 added the status: needs comment/discussion needs consensus on next step label Mar 18, 2026
@MohitPal2005
Copy link
Copy Markdown
Contributor Author

Thanks for the approval and the suggestion!

I’ve looked into the ordering and updated the minigallery to better match the original tutorial order while keeping the changes minimal.

Let me know if you’d prefer a different approach.

Comment thread galleries/tutorials/index.rst Outdated
Comment thread galleries/tutorials/index.rst
@github-actions github-actions Bot added the Documentation: build building the docs label Mar 19, 2026
Comment thread doc/conf.py Outdated

sphinx_gallery_conf = {
'backreferences_dir': Path('api', '_as_gen'),
'minigallery_sort_order': ExplicitOrder([
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.

I was wrong then, you're gonna want something more general (probably) - dig into the sphinx gallery side and see if there's a way to turn off sorting/pass a 'don't sort' key to sorted

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.

Or write something like a yield function/counter such that every entry is mapped to its index (itertools should have something that does the trick). Basically a key function such that the input to sorted doesn't actually get sorted.

@MohitPal2005
Copy link
Copy Markdown
Contributor Author

@story645 Thanks for the feedback!

I’ve updated the implementation to preserve the intended ordering, and all checks are now passing. The docs build also looks correct on my end.

Please let me know if any further changes are needed.

@melissawm melissawm moved this from Waiting for author to Needs review in First Time Contributors Mar 19, 2026
@MohitPal2005
Copy link
Copy Markdown
Contributor Author

Hi @story645 and @melissawm,

Just a quick follow-up on this PR. Since it has already been approved and all checks are passing, I noticed that the “Do Not Merge / Prevent Merging” check is currently the only blocker.

Please let me know if there’s anything I should update from my side, or if it’s just awaiting a label or maintainer action.

Thanks again for your time and review!

@jklymak
Copy link
Copy Markdown
Member

jklymak commented Apr 10, 2026

Using the minigallery directive is fine. I'm not clear why the five tutorials have been divided into three (questionable) categories.

@story645
Copy link
Copy Markdown
Member

story645 commented Apr 10, 2026

Using the minigallery directive is fine. I'm not clear why the five tutorials have been divided into three (questionable) categories.

I think it's an attempt to match https://matplotlib.org/devdocs/tutorials/index.html#user-guide-tutorials

But really I think we should remove the links to the individual user guide entries as I think the two entry points (user guide and tutorials) adds to the confusion about the scope and purpose of those docs. (ETA: but that is a discussion completely out of scope here).

@MohitPal2005 remove the leveling and match the order that's currently on the page to close this PR out.

@MohitPal2005
Copy link
Copy Markdown
Contributor Author

MohitPal2005 commented Apr 10, 2026

Hi @story645,

I have removed the leveling and combined the tutorials into a single minigallery block matching the exact order of the current live page, as requested.

The CircleCI docs build is passing, but it looks like there are some unrelated Windows Pytest failures (matplotlib.matplotlib) that got pulled in from main.

Please let me know if everything looks good to go.

@QuLogic QuLogic removed the status: needs comment/discussion needs consensus on next step label Apr 10, 2026
@QuLogic QuLogic merged commit 5b7f8e7 into matplotlib:main Apr 10, 2026
23 of 26 checks passed
@github-project-automation github-project-automation Bot moved this from Needs review to Merged in First Time Contributors Apr 10, 2026
@QuLogic
Copy link
Copy Markdown
Member

QuLogic commented Apr 10, 2026

Thanks @MohitPal2005! Congratulations on your first PR to Matplotlib 🎉 We hope to hear from you again.

@QuLogic QuLogic added this to the v3.11.0 milestone Apr 10, 2026
@MohitPal2005
Copy link
Copy Markdown
Contributor Author

Huge thanks to @QuLogic, @story645, @melissawm, @jklymak, and @timhoffm for all the reviews, patience, and guidance on this! I learned a ton navigating the process and really look forward to contributing more soon.

@MohitPal2005 MohitPal2005 deleted the fix-issue-name branch April 10, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Development

Successfully merging this pull request may close these issues.

5 participants