René's URL Explorer Experiment


Title: Tutorial pyplot_scales.py crashes when used with plt.tight_layout() · Issue #6789 · matplotlib/matplotlib · GitHub

Open Graph Title: Tutorial pyplot_scales.py crashes when used with plt.tight_layout() · Issue #6789 · matplotlib/matplotlib

X Title: Tutorial pyplot_scales.py crashes when used with plt.tight_layout() · Issue #6789 · matplotlib/matplotlib

Description: Trying to replace plt.subplots_adjust with plt.tight_layout in the pyplot tutorial pyplot_scales.py (see #6779), seems to results in errors. Matplotlib version, Python version and Platform (Windows, OSX, Linux ...): Linux (at least Archl...

Open Graph Description: Trying to replace plt.subplots_adjust with plt.tight_layout in the pyplot tutorial pyplot_scales.py (see #6779), seems to results in errors. Matplotlib version, Python version and Platform (Windows...

X Description: Trying to replace plt.subplots_adjust with plt.tight_layout in the pyplot tutorial pyplot_scales.py (see #6779), seems to results in errors. Matplotlib version, Python version and Platform (Windows...

Opengraph URL: https://github.com/matplotlib/matplotlib/issues/6789

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Tutorial pyplot_scales.py crashes when used with plt.tight_layout()","articleBody":"Trying to replace `plt.subplots_adjust` with `plt.tight_layout` in the pyplot tutorial `pyplot_scales.py` (see #6779), seems to results in errors.\n- [x] Matplotlib version, Python version and Platform (Windows, OSX, Linux ...):\n- Linux (at least Archlinux and CentOs 7)\n- Tested on mpl 1.5.1 from Anaconda and mpl 2.0.0b3.post1799+ga4fdd60 from github\n- [x] MWE (kind of…):\n  Based on `pyplot_scales.py`:\n\n``` python\nimport numpy as np\nimport matplotlib.pyplot as plt\nplt.style.use('default')\n\n# make up some data in the interval ]0, 1[\ny = np.random.normal(loc=0.5, scale=0.4, size=1000)\ny = y[(y \u003e 0) \u0026 (y \u003c 1)]\ny.sort()\nx = np.arange(len(y))\n\nplt.figure(1)\nplt.subplot(221)\nplt.subplot(222)\nplt.subplot(223)\n\n# logit\nplt.subplot(224)\nplt.plot(x, y)\nplt.yscale('logit')\n#plt.subplots_adjust(top=0.92, bottom=0.08, left=0.10, right=0.95, hspace=0.25,\n#                    wspace=0.35)\nplt.tight_layout()\n\nplt.show()\n```\n\nWhen I run this example with `plt.tight_layout` instead of `plt.subplots_adjust` (or simply no subplot layout adjusting at all), I get these outputs (mpl 2.0.0b3.post1799+ga4fdd60):\n- with Qt4Agg backend\n\n```\nIn [1]: run pyplot_scales_mwe.py  # that's the MWE posted above\n/home/adrien/matplotlib/lib/matplotlib/transforms.py:380: RuntimeWarning: invalid value encountered in double_scalars\n  return points[1, 0] - points[0, 0]\n/home/adrien/matplotlib/lib/matplotlib/tight_layout.py:199: RuntimeWarning: invalid value encountered in double_scalars\n  kwargs[\"wspace\"] = hspace / h_axes\n/home/adrien/matplotlib/lib/matplotlib/axis.py:1008: UserWarning: Unable to find pixel distance along axis for interval padding of ticks; assuming no interval padding needed.\n  warnings.warn(\"Unable to find pixel distance along axis \"\n/home/adrien/matplotlib/lib/matplotlib/axis.py:1018: UserWarning: Unable to find pixel distance along axis for interval padding of ticks; assuming no interval padding needed.\n  warnings.warn(\"Unable to find pixel distance along axis \"\n\nTraceback (most recent call last):\n  File \"/home/adrien/matplotlib/lib/matplotlib/backends/backend_qt5agg.py\", line 182, in __draw_idle_agg\n    FigureCanvasAgg.draw(self)\n  File \"/home/adrien/matplotlib/lib/matplotlib/backends/backend_agg.py\", line 464, in draw\n    self.figure.draw(self.renderer)\n  File \"/home/adrien/matplotlib/lib/matplotlib/artist.py\", line 68, in draw_wrapper\n    return draw(artist, renderer, *args, **kwargs)\n  File \"/home/adrien/matplotlib/lib/matplotlib/figure.py\", line 1262, in draw\n    renderer, self, dsu, self.suppressComposite)\n  File \"/home/adrien/matplotlib/lib/matplotlib/image.py\", line 139, in _draw_list_compositing_images\n    a.draw(renderer)\n  File \"/home/adrien/matplotlib/lib/matplotlib/artist.py\", line 68, in draw_wrapper\n    return draw(artist, renderer, *args, **kwargs)\n  File \"/home/adrien/matplotlib/lib/matplotlib/axes/_base.py\", line 2383, in draw\n    mimage._draw_list_compositing_images(renderer, self, dsu)\n  File \"/home/adrien/matplotlib/lib/matplotlib/image.py\", line 139, in _draw_list_compositing_images\n    a.draw(renderer)\n  File \"/home/adrien/matplotlib/lib/matplotlib/artist.py\", line 68, in draw_wrapper\n    return draw(artist, renderer, *args, **kwargs)\n  File \"/home/adrien/matplotlib/lib/matplotlib/axis.py\", line 1109, in draw\n    ticks_to_draw = self._update_ticks(renderer)\n  File \"/home/adrien/matplotlib/lib/matplotlib/axis.py\", line 942, in _update_ticks\n    tick_tups = [t for t in self.iter_ticks()]\n  File \"/home/adrien/matplotlib/lib/matplotlib/axis.py\", line 885, in iter_ticks\n    majorLocs = self.major.locator()\n  File \"/home/adrien/matplotlib/lib/matplotlib/ticker.py\", line 1721, in __call__\n    return self.tick_values(vmin, vmax)\n  File \"/home/adrien/matplotlib/lib/matplotlib/ticker.py\", line 1726, in tick_values\n    locs = self._raw_ticks(vmin, vmax)\n  File \"/home/adrien/matplotlib/lib/matplotlib/ticker.py\", line 1674, in _raw_ticks\n    nbins = max(min(self.axis.get_tick_space(), 9),\n  File \"/home/adrien/matplotlib/lib/matplotlib/axis.py\", line 2008, in get_tick_space\n    return int(np.floor(length / size))\nValueError: cannot convert float NaN to integer\n```\n\nwhich results in\n![with_tight_layout](https://cloud.githubusercontent.com/assets/17270724/16909518/9f14f6e8-4cd3-11e6-9325-2e3ee803cf09.png)\n(NB: it's a screenshot because `savefig` complained about the “ValueError: cannot convert float NaN to integer” stuff)\n- with TkAgg backend\n\n```\nIn [1]: run pyplot_scales_mwe.py  # that's again the MWE posted above\n/home/adrien/matplotlib/lib/matplotlib/transforms.py:380: RuntimeWarning: invalid value encountered in double_scalars\n  return points[1, 0] - points[0, 0]\n/home/adrien/matplotlib/lib/matplotlib/tight_layout.py:199: RuntimeWarning: invalid value encountered in double_scalars\n  kwargs[\"wspace\"] = hspace / h_axes\n/home/adrien/matplotlib/lib/matplotlib/axis.py:1008: UserWarning: Unable to find pixel distance along axis for interval padding of ticks; assuming no interval padding needed.\n  warnings.warn(\"Unable to find pixel distance along axis \"\n/home/adrien/matplotlib/lib/matplotlib/axis.py:1018: UserWarning: Unable to find pixel distance along axis for interval padding of ticks; assuming no interval padding needed.\n  warnings.warn(\"Unable to find pixel distance along axis \"\n\nException in Tkinter callback\nTraceback (most recent call last):\n  File \"/home/adrien/anaconda/envs/Python2.7_matplotlib-git/lib/python2.7/lib-tk/Tkinter.py\", line 1536, in __call__\n    return self.func(*args)\n  File \"/home/adrien/matplotlib/lib/matplotlib/backends/backend_tkagg.py\", line 283, in resize\n    self.show()\n  File \"/home/adrien/matplotlib/lib/matplotlib/backends/backend_tkagg.py\", line 354, in draw\n    FigureCanvasAgg.draw(self)\n  File \"/home/adrien/matplotlib/lib/matplotlib/backends/backend_agg.py\", line 464, in draw\n    self.figure.draw(self.renderer)\n  File \"/home/adrien/matplotlib/lib/matplotlib/artist.py\", line 68, in draw_wrapper\n    return draw(artist, renderer, *args, **kwargs)\n  File \"/home/adrien/matplotlib/lib/matplotlib/figure.py\", line 1262, in draw\n    renderer, self, dsu, self.suppressComposite)\n  File \"/home/adrien/matplotlib/lib/matplotlib/image.py\", line 139, in _draw_list_compositing_images\n    a.draw(renderer)\n  File \"/home/adrien/matplotlib/lib/matplotlib/artist.py\", line 68, in draw_wrapper\n    return draw(artist, renderer, *args, **kwargs)\n  File \"/home/adrien/matplotlib/lib/matplotlib/axes/_base.py\", line 2383, in draw\n    mimage._draw_list_compositing_images(renderer, self, dsu)\n  File \"/home/adrien/matplotlib/lib/matplotlib/image.py\", line 139, in _draw_list_compositing_images\n    a.draw(renderer)\n  File \"/home/adrien/matplotlib/lib/matplotlib/artist.py\", line 68, in draw_wrapper\n    return draw(artist, renderer, *args, **kwargs)\n  File \"/home/adrien/matplotlib/lib/matplotlib/axis.py\", line 1109, in draw\n    ticks_to_draw = self._update_ticks(renderer)\n  File \"/home/adrien/matplotlib/lib/matplotlib/axis.py\", line 942, in _update_ticks\n    tick_tups = [t for t in self.iter_ticks()]\n  File \"/home/adrien/matplotlib/lib/matplotlib/axis.py\", line 885, in iter_ticks\n    majorLocs = self.major.locator()\n  File \"/home/adrien/matplotlib/lib/matplotlib/ticker.py\", line 1721, in __call__\n    return self.tick_values(vmin, vmax)\n  File \"/home/adrien/matplotlib/lib/matplotlib/ticker.py\", line 1726, in tick_values\n    locs = self._raw_ticks(vmin, vmax)\n  File \"/home/adrien/matplotlib/lib/matplotlib/ticker.py\", line 1674, in _raw_ticks\n    nbins = max(min(self.axis.get_tick_space(), 9),\n  File \"/home/adrien/matplotlib/lib/matplotlib/axis.py\", line 2008, in get_tick_space\n    return int(np.floor(length / size))\nValueError: cannot convert float NaN to integer\n```\n\nwhich produces an empty figure.\n- [x] If this is an image generation bug attach a screenshot demonstrating the issue:\n  See above.\n- [x] If this is a regression (Used to work in an earlier version of Matplotlib), please \n    note where it used to work:\n  The behavior seems to be the same with mpl 1.5.1 and (at least) both TkAgg and Qt4Agg backends.\n","author":{"url":"https://github.com/afvincent","@type":"Person","name":"afvincent"},"datePublished":"2016-07-18T08:46:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/6789/matplotlib/issues/6789"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:ae95338b-c805-96f3-fc5a-81923dba58de
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEBDA:39E76C:1CB3352:271289C:6A5400CE
html-safe-nonce9cef075f9b4f81a65abd8a8567b73857af5b6908d1da3db19cdef70c845989c0
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkRBOjM5RTc2QzoxQ0IzMzUyOjI3MTI4OUM6NkE1NDAwQ0UiLCJ2aXNpdG9yX2lkIjoiODAyOTYyOTA4NjA4NjQ2MzY5NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacb8ee17587f8dc92cc1fc33711c06d1ab5c9bbd50d49573394fe5f950babe9822
hovercard-subject-tagissue:166046826
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/6789/issue_layout
twitter:imagehttps://opengraph.githubassets.com/b41dec635e5fe7f217a9cbfa643589896f9fdad23a3c539576e9c491f8cdd38b/matplotlib/matplotlib/issues/6789
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/b41dec635e5fe7f217a9cbfa643589896f9fdad23a3c539576e9c491f8cdd38b/matplotlib/matplotlib/issues/6789
og:image:altTrying to replace plt.subplots_adjust with plt.tight_layout in the pyplot tutorial pyplot_scales.py (see #6779), seems to results in errors. Matplotlib version, Python version and Platform (Windows...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameafvincent
hostnamegithub.com
expected-hostnamegithub.com
Noneb9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release07a982c1d40157c619b364352b704c3ce66bb332
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/matplotlib/matplotlib/issues/6789#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F6789
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%2Fissues%2F6789
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%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=matplotlib%2Fmatplotlib
Reloadhttps://github.com/matplotlib/matplotlib/issues/6789
Reloadhttps://github.com/matplotlib/matplotlib/issues/6789
Reloadhttps://github.com/matplotlib/matplotlib/issues/6789
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/6789
matplotlib https://github.com/matplotlib
matplotlibhttps://github.com/matplotlib/matplotlib
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/6789
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
Tutorial pyplot_scales.py crashes when used with plt.tight_layout()https://github.com/matplotlib/matplotlib/issues/6789#top
https://github.com/afvincent
afvincenthttps://github.com/afvincent
on Jul 18, 2016https://github.com/matplotlib/matplotlib/issues/6789#issue-166046826
#6779https://github.com/matplotlib/matplotlib/pull/6779
https://cloud.githubusercontent.com/assets/17270724/16909518/9f14f6e8-4cd3-11e6-9325-2e3ee803cf09.png
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.