René's URL Explorer Experiment


Title: Plot directive preserve by r-barnes · Pull Request #10149 · matplotlib/matplotlib · GitHub

Open Graph Title: Plot directive preserve by r-barnes · Pull Request #10149 · matplotlib/matplotlib

X Title: Plot directive preserve by r-barnes · Pull Request #10149 · matplotlib/matplotlib

Description: PR Summary The Sphinx plot directive can be used to automagically generate figures for documentation like so: .. plot:: import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np img = mpimg.imread('_static/stinkbug.png') imgplot = plt.imshow(img) But, if you reorder the figures in the documentation then all the figures may need to be rebuilt. This takes time. The names given to the figures are also fairly meaningless, making them more difficult to index by search engines or to find on a filesystem. Alternatively, if you are compiling on a limited-resource service like ReadTheDocs, you may wish to build imagery locally to avoid hitting resource limits on the server. Using the new changes allows extensive dynamically generated imagery to be used on services like ReadTheDocs. The :outname: property These problems are addressed through two new features in the plot directive. The first is the introduction of the :outname: property. It is used like so: .. plot:: :outname: stinkbug_plot import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np img = mpimg.imread('_static/stinkbug.png') imgplot = plt.imshow(img) Without :outname:, the figure generated above would normally be called, e.g. docfile3-4-01.png or something equally mysterious. With :outname: the figure generated will instead be named stinkbug_plot-01.png or even stinkbug_plot.png. This makes it easy to understand which output image is which and, more importantly, uniquely keys output images to code snippets. The plot_preserve_dir configuration value Setting the plot_preserve_dir configuration value to the name of a directory will cause all images with :outname: set to be copied to this directory upon generation. If an image is already in plot_preserve_dir when documentation is being generated, this image is copied to the build directory thereby pre-empting generation and reducing computation time in low-resource environments. Related issues were raised on ReadTheDocs (link) and on StackOverflow (link). PR Checklist Has Pytest style unit tests It would, but I'm not sure how to go about writing them. Sorry :-/ Code is PEP 8 compliant Leastwise, nothing new is added to the numerous pre-existing violations. PEP8 adherence makes code difficult to read :-/ New features are documented, with examples if plot related Documentation is sphinx and numpydoc compliant Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there) Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

Open Graph Description: PR Summary The Sphinx plot directive can be used to automagically generate figures for documentation like so: .. plot:: import matplotlib.pyplot as plt import matplotlib.image as mpimg im...

X Description: PR Summary The Sphinx plot directive can be used to automagically generate figures for documentation like so: .. plot:: import matplotlib.pyplot as plt import matplotlib.image as mpimg im...

Opengraph URL: https://github.com/matplotlib/matplotlib/pull/10149

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:b00c4cdf-f909-dc27-25ec-a8d8136c0b49
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA12A:2B7671:15ED962:1DCB143:6A546506
html-safe-nonce2b43cb5aec4162a7322bc2f73058ba3ccc358bc887597954e9853c3cb3fa60ca
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMTJBOjJCNzY3MToxNUVEOTYyOjFEQ0IxNDM6NkE1NDY1MDYiLCJ2aXNpdG9yX2lkIjoiMzcxMTU2OTYwNjM2MTc2OTIyMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac69118ebbd47e8e06e270fd733d9e83b1a78b95c8d3d8529d8a8e98b78e060b34
hovercard-subject-tagpull_request:160991335
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/matplotlib/matplotlib/pull/10149/files
twitter:imagehttps://avatars.githubusercontent.com/u/3118036?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/3118036?s=400&v=4
og:image:altPR Summary The Sphinx plot directive can be used to automagically generate figures for documentation like so: .. plot:: import matplotlib.pyplot as plt import matplotlib.image as mpimg im...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneb9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git
octolytics-dimension-user_id215947
octolytics-dimension-user_loginmatplotlib
octolytics-dimension-repository_id1385122
octolytics-dimension-repository_nwomatplotlib/matplotlib
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1385122
octolytics-dimension-repository_network_root_nwomatplotlib/matplotlib
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release6d28624802c2f7d9500239dd6870ed7031b7353b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/matplotlib/matplotlib/pull/10149/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fpull%2F10149%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fpull%2F10149%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=matplotlib%2Fmatplotlib
Reloadhttps://github.com/matplotlib/matplotlib/pull/10149/files
Reloadhttps://github.com/matplotlib/matplotlib/pull/10149/files
Reloadhttps://github.com/matplotlib/matplotlib/pull/10149/files
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/10149/files
matplotlib https://github.com/matplotlib
matplotlibhttps://github.com/matplotlib/matplotlib
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/10149/files
Notifications https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Fork 8.4k https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Star 23k https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Code https://github.com/matplotlib/matplotlib
Issues 1.1k https://github.com/matplotlib/matplotlib/issues
Pull requests 408 https://github.com/matplotlib/matplotlib/pulls
Actions https://github.com/matplotlib/matplotlib/actions
Projects https://github.com/matplotlib/matplotlib/projects
Wiki https://github.com/matplotlib/matplotlib/wiki
Security and quality 0 https://github.com/matplotlib/matplotlib/security
Insights https://github.com/matplotlib/matplotlib/pulse
Code https://github.com/matplotlib/matplotlib
Issues https://github.com/matplotlib/matplotlib/issues
Pull requests https://github.com/matplotlib/matplotlib/pulls
Actions https://github.com/matplotlib/matplotlib/actions
Projects https://github.com/matplotlib/matplotlib/projects
Wiki https://github.com/matplotlib/matplotlib/wiki
Security and quality https://github.com/matplotlib/matplotlib/security
Insights https://github.com/matplotlib/matplotlib/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fmatplotlib%2Fmatplotlib%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib%2Fissues%2Fnew%2Fchoose
r-barneshttps://github.com/r-barnes
matplotlib:mainhttps://github.com/matplotlib/matplotlib/tree/main
r-barnes:plot_directive_preservehttps://github.com/r-barnes/matplotlib/tree/plot_directive_preserve
Conversation 23 https://github.com/matplotlib/matplotlib/pull/10149
Commits 13 https://github.com/matplotlib/matplotlib/pull/10149/commits
Checks 0 https://github.com/matplotlib/matplotlib/pull/10149/checks
Files changed https://github.com/matplotlib/matplotlib/pull/10149/files
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/10149/files
Plot directive preserve https://github.com/matplotlib/matplotlib/pull/10149/files#top
Show all changes 13 commits https://github.com/matplotlib/matplotlib/pull/10149/files
b8c5559 Added `:outname:` option and `plot_preserve_dir` configuration value r-barnes Jan 3, 2018 https://github.com/matplotlib/matplotlib/pull/10149/commits/b8c5559adeaf626d289d5c4176a6d0cda33faf59
d4c41ff Added What's New for plot directive changes r-barnes Jan 3, 2018 https://github.com/matplotlib/matplotlib/pull/10149/commits/d4c41ff7a1e19c732e4d41c74167de4f58b7063f
69356da Futzing with PEP8 whitespace stuff. r-barnes Jan 3, 2018 https://github.com/matplotlib/matplotlib/pull/10149/commits/69356da3b43add8483f404a534dc57866dfdbc88
8b477a4 Fix grammer r-barnes Jan 3, 2018 https://github.com/matplotlib/matplotlib/pull/10149/commits/8b477a42736ab842a76957abe2d9b6f155b2296f
fddd490 Fix bug with adding null string to outname_list r-barnes Jan 3, 2018 https://github.com/matplotlib/matplotlib/pull/10149/commits/fddd4900de4df1ba46393e2f2cde23c662515b64
872faa1 Added a test of `:outname:` r-barnes Jan 3, 2018 https://github.com/matplotlib/matplotlib/pull/10149/commits/872faa1cb9390112212ace10f653cd4672f1ad99
0ee71f0 Examples of using rst need to be code blocks r-barnes Jan 3, 2018 https://github.com/matplotlib/matplotlib/pull/10149/commits/0ee71f09861907b3385f695edfccc6c7cc0cec6b
082298e Use logging instead of print r-barnes Jan 3, 2018 https://github.com/matplotlib/matplotlib/pull/10149/commits/082298e3330f9193382673eadebddd874073128c
73858c1 Satisfy PEP8 checks r-barnes Jan 3, 2018 https://github.com/matplotlib/matplotlib/pull/10149/commits/73858c1a702d164ee02c95b33b1950cea9aff66b
74e9fbc FIX: issue with rebase due to re-naming of local variables tacaswell Aug 12, 2019 https://github.com/matplotlib/matplotlib/pull/10149/commits/74e9fbc06f2f6807c62c0c12a32c01b8bdc354f7
cd78416 STY: fix line length and indentation issues tacaswell Aug 12, 2019 https://github.com/matplotlib/matplotlib/pull/10149/commits/cd784160ec0889e73218c66f936b7f5d8b1b8631
725f25d STY: trim whitespace and add trailing comma tacaswell Aug 12, 2019 https://github.com/matplotlib/matplotlib/pull/10149/commits/725f25d87d3175919faba198cd85ce849901a7ea
134aaf9 Fix doc style timhoffm Nov 24, 2019 https://github.com/matplotlib/matplotlib/pull/10149/commits/134aaf966d48b2d85e35911119ef871d0ff7bf70
Clear filters https://github.com/matplotlib/matplotlib/pull/10149/files
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/10149/files
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/10149/files
2018_12_03_sphinx_plot_preserve.rst https://github.com/matplotlib/matplotlib/pull/10149/files#diff-03a43babfe6b2ea42185238391b971d28cf499382c9ac4ce07eb2d748e298c2c
plot_directive.py https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
some_plots.rst https://github.com/matplotlib/matplotlib/pull/10149/files#diff-08da46b74648ed5eacf3e9819072ef928f3d8b18447b0f4909c85feb27cfba43
doc/users/next_whats_new/2018_12_03_sphinx_plot_preserve.rsthttps://github.com/matplotlib/matplotlib/pull/10149/files#diff-03a43babfe6b2ea42185238391b971d28cf499382c9ac4ce07eb2d748e298c2c
View file https://github.com/r-barnes/matplotlib/blob/134aaf966d48b2d85e35911119ef871d0ff7bf70/doc/users/next_whats_new/2018_12_03_sphinx_plot_preserve.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/matplotlib/matplotlib/pull/10149/{{ revealButtonHref }}
timhoffmhttps://github.com/timhoffm
Nov 24, 2019https://github.com/matplotlib/matplotlib/pull/10149/files#r349938403
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/10149/files
lib/matplotlib/sphinxext/plot_directive.pyhttps://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
View file https://github.com/r-barnes/matplotlib/blob/134aaf966d48b2d85e35911119ef871d0ff7bf70/lib/matplotlib/sphinxext/plot_directive.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/matplotlib/matplotlib/pull/10149/{{ revealButtonHref }}
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
timhoffmhttps://github.com/timhoffm
Nov 24, 2019https://github.com/matplotlib/matplotlib/pull/10149/files#r349938328
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/matplotlib/matplotlib/pull/10149/files
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-1565d78306cf72de5a28f4e2b196ee2cb09026d1f8aa2dc26178c3a47f3347b8
lib/matplotlib/tests/tinypages/some_plots.rsthttps://github.com/matplotlib/matplotlib/pull/10149/files#diff-08da46b74648ed5eacf3e9819072ef928f3d8b18447b0f4909c85feb27cfba43
View file https://github.com/r-barnes/matplotlib/blob/134aaf966d48b2d85e35911119ef871d0ff7bf70/lib/matplotlib/tests/tinypages/some_plots.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/matplotlib/matplotlib/pull/10149/{{ revealButtonHref }}
https://github.com/matplotlib/matplotlib/pull/10149/files#diff-08da46b74648ed5eacf3e9819072ef928f3d8b18447b0f4909c85feb27cfba43
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.