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

Skip to content

[Doc][Examples Gallery]: Side Navigation Section breaks on Animation … #25908

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

Closed
wants to merge 1 commit into from

Conversation

Mubin17
Copy link
Contributor

@Mubin17 Mubin17 commented May 18, 2023

PR summary

This pull request is to address Issue #25836

The current behavior of the Animation Examples Gallery in the documentation is causing an inconsistent navigation experience. When clicking on any of the animation examples, the side navigation section displays links to the matplotlib API reference instead of the examples gallery. This PR removes the API reference links in the animation_api.rst which should fix Issue #25836.

This is what the side navigation looks like at the moment:
Screenshot 2023-05-17 at 11 22 32 PM

This is what it should look like:
Screenshot 2023-05-17 at 11 07 42 PM

@ksunden @codingtosh

PR checklist

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. 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

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

@codingtosh
Copy link

Hi @Mubin17 Thank you for looking into this and welcome to the community. This is a good starting point, but we need the navigation section to appear like it does here:
expected behavior

We would like to show the Examples links, as opposed to the API links ( that reference the matplotlib.* library ). To understand this better, click on pyplot animation from the navigation section and then see what the navigation section continues to display. It should be the same as the above screenshot.

Whereas, if you were to click on some other example from the navigation section like Decay, it will load all the matplotlib api links in the navigation section, as opposed to retaining the examples links like it does in the pyplot animation as shown in your screenshot.

unexpected behavior

This is what we want to fix.

@Mubin17
Copy link
Contributor Author

Mubin17 commented May 23, 2023

Thank you @codingtosh for reviewing my PR. I believe that the problem lies with the examples mentioned/referenced in the animation_api.rst file. They seem to be causing the website to break, while the examples not referenced their work just fine.

Here is a list of examples referenced in the animation_api.rst:

  • Decay
  • The Bayes update
  • The double pendulum problem
  • Animated histogram
  • Rain simulation
  • Animated 3D random walk
  • Animated line plot
  • Oscilloscope
  • MATPLOTLIB UNCHAINED
  • Animated image using a precomputed list of images
  • Frame grabbing
Screenshot 2023-05-22 at 7 06 44 PM Screenshot 2023-05-22 at 7 07 03 PM

And here is the list of examples not referenced in animation_api.rst

  • pyplot animation
  • Multiple axes animation
  • pasuing and resuming an animation
  • animated scatter saved as gif

Based on this observation, it appears that the examples mentioned in animation_api.rst are the root cause of the problem.

The solution that I am proposing involves removing the examples from the animation_api.rst file entirely. By doing so, we can effectively break the linkage between the Example links and API links, which should resolve the issue with the side navigation.

Additionally, this solution has the advantage of providing cleaner side navigation for the API references, as shown in the following example: https://user-images.githubusercontent.com/48038715/239146952-a8db6b1d-605a-4bbc-9ae0-f52ef564da45.png

If there's a specific need to reference Example links in animation_api.rst, we can brainstorm some alternative approaches to achieve that while keeping the navigation section intact. I'm open to discussion.

@melissawm
Copy link
Member

Hello @Mubin17 - thanks for looking into this!

I think my preference would be to remove the toctree but keep simple links to the examples. I'll show what I mean below:

@@ -165,33 +165,9 @@ function::
A third method is to use closures to build up the required
artists and functions. A fourth method is to create a class.

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
Examples
~~~~~~~~
* :doc:`../gallery/animation/animate_decay`
* :doc:`../gallery/animation/bayes_update`
* :doc:`../gallery/animation/double_pendulum`
* :doc:`../gallery/animation/animated_histogram`
* :doc:`../gallery/animation/rain`
* :doc:`../gallery/animation/random_walk`
* :doc:`../gallery/animation/simple_anim`
* :doc:`../gallery/animation/strip_chart`
* :doc:`../gallery/animation/unchained`

../gallery/animation/simple_anim
../gallery/animation/strip_chart
../gallery/animation/unchained

``ArtistAnimation``
-------------------

Copy link
Member

Choose a reason for hiding this comment

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

Same thing here:

Suggested change
Examples
~~~~~~~~
* :doc:`../gallery/animation/dynamic_image`

@@ -270,14 +246,6 @@ strongly encouraged to use the `~.AbstractMovieWriter.saving` context manager::

to ensure that setup and cleanup are performed as necessary.

Copy link
Member

Choose a reason for hiding this comment

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

And here:

Suggested change
Examples
--------
* :doc:`../gallery/animation/frame_grabbing_sgskip`

Copy link
Member

@melissawm melissawm left a comment

Choose a reason for hiding this comment

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

Looks great to me now, thanks @Mubin17 !

@Mubin17
Copy link
Contributor Author

Mubin17 commented May 24, 2023

Thanks for the help @melissawm. I've squashed all the commits into one for the sake of clean-up. Let me know if there are any additional changes you would like me to address. Thanks again!

@Mubin17 Mubin17 requested a review from melissawm May 24, 2023 14:02
@melissawm melissawm requested a review from story645 May 24, 2023 14:02
@codingtosh
Copy link

Thanks for narrowing it down @Mubin17 , that was a sharp observation. Nicely done! For my reference, could you show me the screenshot of how the navigation section looks like when you reproduce the steps mentioned in #25908 after these changes?

@rcomer
Copy link
Member

rcomer commented May 24, 2023

There should have been an automatic check of the doc build and a link that allows us to view how the docs look with this change. I don’t know why that didn’t happen, but I’ll try closing and re-opening to see if that triggers it…

@rcomer rcomer closed this May 24, 2023
@rcomer rcomer reopened this May 24, 2023
@QuLogic
Copy link
Member

QuLogic commented May 25, 2023

Maybe because it's on main branch? Even tests aren't running.

@Mubin17
Copy link
Contributor Author

Mubin17 commented May 25, 2023

@QuLogic I usually create a new branch for my pull requests, but it seems like I forgot to do it this time. My bad! Would creating a new PR on a separate branch help?

@QuLogic
Copy link
Member

QuLogic commented May 25, 2023

It may help; I don't see anything obvious that would have been stopping it though.

@Mubin17
Copy link
Contributor Author

Mubin17 commented May 25, 2023

I have made a new PR [#25977] on a separate branch. I hope it helps

@QuLogic
Copy link
Member

QuLogic commented May 25, 2023

OK, we'll see there.

@QuLogic QuLogic closed this May 25, 2023
@rcomer
Copy link
Member

rcomer commented May 25, 2023

Even tests aren't running.

We deliberately skip tests if all the changes are under doc, so that’s expected. E.g. #25707.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for author
Development

Successfully merging this pull request may close these issues.

5 participants