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
Rewrite Tick formatters example #26068
Conversation
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.
Since it's all getting combined and the code doesn't matter, is there anyway to loop over the arguments so that the titles have to stay in sync w/ the code?
5b4acbc
to
b94ff32
Compare
I don't think so. While https://matplotlib.org/stable/gallery/ticks/date_formatters_locators.html does something like that, the special code for FuncFormatter and FixedFormatter make it difficult here. I'm not at all worried about "stay in sync". This will hardly change and the title and formatter code are always in neighboring lines. |
My own bias, but can you put the figure before the code since the code isn't the important part? |
AFAIK this is not possible in sphinx-gallery. What I would like even more would be an option to collapse code blocks in sphinx-gallery, but that's also not supported. |
According to this page, if there is only one code block the image appears before the code. I am not clear how it is counting more than one code block for the current case 😕 |
Likely it counts:
In this example we have the References text block after the code. Likely that prevents the reordering, which makes sense because it would bring two description blocks together that we have written separately. should I move this up? If so, I would reduce it to the set-*-formatter references. The references section is mainly there to generate the backreferences mini-galleries. This is anyway not happening on the formatter classes and not important for the other functions mentioned. |
I think you can probably drop it here since that's more or less what you're frontloading with the text. I think having a more prominent figure should be the priority since that's kinda the important part of this example (as an aside/out of scope here though, maybe the figure should go into the ticker docs since it's a reference for the formatters and same for the locators) |
I think the reference section is no longer needed to generate the mini-galleries. For example plt.rcdefaults's gallery shows two examples that do not have the explicit reference list. These days the functions within the code work as clickable links, so maybe it gets it from that? |
It depends. Sphinx-gallery cannot infer all objects. For example, |
b94ff32
to
4684351
Compare
The references section is gone. I've additionally removed the "Dollar ticks" example (closes #25967). The formatting is more concisely explained in this overview. We don't need individual examples for all the formatters. |
The dollar ticks example is included here: matplotlib/galleries/tutorials/artists.py Lines 719 to 725 in 5f29763
|
4684351
to
982f6bd
Compare
I've restored the dollar ticks example. Let's handle this in another PR. |
- Collect all relevant descriptions in the summary text at the top - Merge everything into one figure. The code should be mostly irrelevant for the example. The figure can serve as a standalone reference.
982f6bd
to
2fe9ef7
Compare
See :ref:`formatters` for a complete list. | ||
|
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.
See :ref:`formatters` for a complete list. | |
See :ref:`formatters` for a complete list. |
Take or leave unindenting this so that this is a bit more prominent. Can self merge
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.
The list is a list of formatters. So indentation is correct IMHO
Also closes 25967 by deleting the "Dollar ticks" example.[Deferred]