Add thumbnail for embedding in user interfaces examples#31365
Add thumbnail for embedding in user interfaces examples#31365timhoffm merged 2 commits intomatplotlib:mainfrom
Conversation
|
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. We also ask that you please finish addressing any review comments on this PR and wait for it to be merged (or closed) before opening a new one, as it can be a valuable learning experience to go through the review process. 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. |
|
While these images are displaying what the Matplotlib side of the examples produce, I don't think these are good indicators of what the examples are. The point of the embedding examples is that they are in Tk (or Qt or whatever); if we wanted just the Matplotlib part, these would be regular examples without any of that extra stuff. |
|
Thanks for the feedback @QuLogic! You're right the screenshots should show the full GUI window including the Tk/Qt frame and controls, not just the Matplotlib plot. I will retake the screenshots to show the complete embedding context. |
|
@QuLogic Retook all screenshots to show the full GUI window including title bar, toolbar, slider and controls. Also squashed all commits into one clean commit. |
bf61460 to
88597e9
Compare
timhoffm
left a comment
There was a problem hiding this comment.
Thanks for the PR!
The thumbnails don't render because you have used a rST comment instead of a python comment. Please take more care and validate that a PR you propose actually solves the issue.
The images are larger than need be. Please recheck, but I think thumbnails should have a size of 320x224 px.
Also please run the images through a png minifier such as optipng or https://tinypng.com/
| .. sphinx_gallery_thumbnail_path = 'gallery/user_interfaces/images/canvasagg.png' | ||
|
|
There was a problem hiding this comment.
Per https://sphinx-gallery.github.io/stable/configuration.html#providing-thumbnail this has to be a python comment, not an rST comment. So put at the beginning of the code section (l.29)
Also for all other examples.
There was a problem hiding this comment.
Fixed! Moved the thumbnail path to the code section as a Python comment (#) for all examples, resized images to 320x224px, and compressed them. Will push the updated commit shortly
6cd1736 to
db96ecd
Compare
timhoffm
left a comment
There was a problem hiding this comment.
Simply rescaling the images to 320x224 distorts them.
Either check whether other sizes work as well or pad with transparency appropriately.
Sorry about that! Will fix the images to preserve aspect ratio by padding with transparency instead of stretching. |
9302626 to
7662588
Compare
Fixed the aspect ratio images are now padded with transparency to fit 320x224 without distortion |
|
Um no? E.g. galleries/examples/user_interfaces/images/embedding_in_qt.png is obviously distorted
|
7662588 to
6ef6ad9
Compare
Retook all screenshots in landscape orientation to avoid distortion. Images are 320x224 with transparent padding where needed |
|
The images do not show up in the rendered docs: https://output.circle-artifacts.com/output/job/a27ab015-7022-49c3-bed8-3c0da41fca64/artifacts/0/doc/build/html/gallery/index.html#embedding-matplotlib-in-graphical-user-interfaces |
6ef6ad9 to
a6460a3
Compare
Fixed the thumbnail paths to use _static/ and moved images there |
a6460a3 to
de662b8
Compare
timhoffm
left a comment
There was a problem hiding this comment.
Thanks, works now.
As a final cleanup, please remove the unnecessary added empty lines.
DOC: Fix thumbnail comment syntax and resize images to 320x224 DOC: Fix image aspect ratio with transparent padding DOC: Retake screenshots in landscape and fix aspect ratio DOC: Move thumbnails to _static and fix thumbnail paths DOC: Add SVG thumbnails to _static DOC: Remove unnecessary blank lines
de662b8 to
a0ec688
Compare
Removed the unnecessary blank lines. |
timhoffm
left a comment
There was a problem hiding this comment.
There are still blank lines.
Please note that the quality and your reactions are lacking, causing extra effort through additional review cycles. I'll now push the needed changes and squash merge, because it's not worth spending more time on this.
Co-authored-by: Tim Hoffmann <[email protected]>
|
Thank you for the patience and for pushing the final fix. I'll make sure to test more carefully before submitting next time. |


Adds thumbnails for multiple sgskip examples in the user_interfaces gallery that were missing preview images.
Examples covered:
embedding_in_tk_sgskip.py(Tkinter)embedding_in_qt_sgskip.py(PyQt5)embedding_webagg_sgskip.py(WebAgg)toolmanager_sgskip.pysvg_histogram_sgskip.pysvg_tooltip_sgskip.pycanvasagg.pyEach example has a screenshot saved in
images/andsphinx_gallery_thumbnail_pathadded to its docstring.Closes #17479
AI Disclosure
No AI used.
PR Checklist