René's URL Explorer Experiment


Title: Text alignment · Issue #1180 · matplotlib/matplotlib · GitHub

Open Graph Title: Text alignment · Issue #1180 · matplotlib/matplotlib

X Title: Text alignment · Issue #1180 · matplotlib/matplotlib

Description: Hi, I added a quick patch to allow numerical values for text alignment. It now allows a number that is fraction of text hight or with and is measured relative to bottom or left. So ha = 0 == 'left' ha = 1 == 'right' va = 0 == 'bottom' va...

Open Graph Description: Hi, I added a quick patch to allow numerical values for text alignment. It now allows a number that is fraction of text hight or with and is measured relative to bottom or left. So ha = 0 == 'left'...

X Description: Hi, I added a quick patch to allow numerical values for text alignment. It now allows a number that is fraction of text hight or with and is measured relative to bottom or left. So ha = 0 == 'l...

Mail addresses
matplotlib@2sn.net
matplotlib@2sn.net

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Text alignment","articleBody":"Hi,\n\nI added a quick patch to allow numerical values for text alignment.\nIt now allows a number that is fraction of text hight or with and is measured relative to bottom or left.  So\nha = 0 == 'left'\nha = 1 == 'right'\nva = 0 == 'bottom'\nva = 1 == 'top'\nva/ha = 0.5 == 'center'\n\nthe cool thing is that values outside [0,1] allow you to some defined distance from a line or symbol that remains well-measured even if you interactively scale the figure.\n\nCan you please add this to MPL?\n\n(also fixed some typos in typo doc)\n\nThis is my first addition here, not sure how to add patches, I can submit a pull request it appears.\n\n-Alexander\n\nhttps://github.com/2sn/matplotlib/compare/master...text-numeric-va-ha\n\nFrom b167849f438e4b77319c51fd603946525823edc0 Mon Sep 17 00:00:00 2001\nFrom: Alexander Heger matplotlib@2sn.net\nDate: Fri, 31 Aug 2012 16:58:04 +1000\nSubject: [PATCH 1/2] ADD - added numeric update for ha and va in Text\n\n---\n\n lib/matplotlib/text.py | 34 +++++++++++++++++++---------------\n 1 file changed, 19 insertions(+), 15 deletions(-)\n\ndiff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py\nindex b00e4cf..b1188de 100644\n--- a/lib/matplotlib/text.py\n+++ b/lib/matplotlib/text.py\n@@ -10,7 +10,7 @@ from matplotlib import cbook\n from matplotlib import rcParams\n import matplotlib.artist as artist\n from matplotlib.artist import Artist\n-from matplotlib.cbook import is_string_like, maxdict\n+from matplotlib.cbook import is_string_like, maxdict, is_numlike\n from matplotlib import docstring\n from matplotlib.font_manager import FontProperties\n from matplotlib.patches import bbox_artist, YAArrow, FancyBboxPatch, \\\n@@ -69,21 +69,21 @@ docstring.interpd.update(Text =  \"\"\"\n     family                     [ 'serif' | 'sans-serif' | 'cursive' | 'fantasy' | 'monospace' ]\n     figure                     a matplotlib.figure.Figure instance\n     fontproperties             a matplotlib.font_manager.FontProperties instance\n-    horizontalalignment or ha  [ 'center' | 'right' | 'left' ]\n-    horizontalalignment or ha  [ 'center' | 'right' | 'left' | fraction text width from left ]\n   label                      any string\n   linespacing                float\n   lod                        [True | False]\n   multialignment             ['left' | 'right' | 'center' ]\n   name or fontname           string eg, ['Sans' | 'Courier' | 'Helvetica' ...]\n   position                   (x,y)\n-    rotation                   [ angle in degrees 'vertical' | 'horizontal'\n-    rotation                   [ angle in degrees | 'vertical' | 'horizontal' ]\n   rotation_mode              [ None | 'anchor']\n   size or fontsize           [ size in points | relative size eg 'smaller', 'x-large' ]\n   style or fontstyle         [ 'normal' | 'italic' | 'oblique']\n   text                       string\n   transform                  a matplotlib.transform transformation instance\n   variant                    [ 'normal' | 'small-caps' ]\n-    verticalalignment or va    [ 'center' | 'top' | 'bottom' | 'baseline' ]\n-    verticalalignment or va    [ 'center' | 'top' | 'bottom' | 'baseline' | fraction text height from bottom ]\n   visible                    [True | False]\n   weight or fontweight       [ 'normal' | 'bold' | 'heavy' | 'light' | 'ultrabold' | 'ultralight']\n   x                          float\n  @@ -378,25 +378,29 @@ class Text(Artist):\n       if  rotation_mode != \"anchor\":\n           # compute the text location in display coords and the offsets\n           # necessary to align the bbox with that location\n-            if halign=='center':  offsetx = (xmin + width/2.0)\n-            if halign=='center':  offsetx = (xmin + width*0.5)\n           elif halign=='right': offsetx = (xmin + width)\n- ```\n         elif is_numlike(halign): offsetx = xmin + halign * (xmax - xmin)\n       else: offsetx = xmin\n  ```\n- ```\n         if valign=='center': offsety = (ymin + height/2.0)\n  ```\n-            if valign=='center': offsety = (ymin + height*0.5)\n           elif valign=='top': offsety  = (ymin + height)\n           elif valign=='baseline': offsety = (ymin + height) - baseline\n- ```\n         elif is_numlike(valign): offsety = ymin + valign * (ymax - ymin)\n       else: offsety = ymin\n   else:\n       xmin1, ymin1 = cornersHoriz[0]\n       xmax1, ymax1 = cornersHoriz[2]\n  ```\n- ```\n         if halign=='center':  offsetx = (xmin1 + xmax1)/2.0\n  ```\n-            if halign=='center':  offsetx = (xmin1 + xmax1)*0.5\n           elif halign=='right': offsetx = xmax1\n- ```\n         elif is_numlike(halign): offsetx = xmin1 + halign * (xmax1 - xmin1)\n       else: offsetx = xmin1\n  ```\n- ```\n         if valign=='center': offsety = (ymin1 + ymax1)/2.0\n  ```\n-            if valign=='center': offsety = (ymin1 + ymax1)*0.5\n           elif valign=='top': offsety  = ymax1\n           elif valign=='baseline': offsety = ymax1 - baseline\n- ```\n         elif is_numlike(valign): offsety = ymin1 + valign * (ymax1 - ymin1)\n       else: offsety = ymin1\n  \n       offsetx, offsety = M.transform_point((offsetx, offsety))\n  ```\n  \n  @@ -796,11 +800,11 @@ class Text(Artist):\n       \"\"\"\n       Set the horizontal alignment to one of\n- ```\n     ACCEPTS: [ 'center' | 'right' | 'left' ]\n  ```\n-        ACCEPTS: [ 'center' | 'right' | 'left' | fraction text width from left ]\n       \"\"\"\n       legal = ('center', 'right', 'left')\n-        if align not in legal:\n-            raise ValueError('Horizontal alignment must be one of %s' % str(legal))\n-        if align not in legal and not is_numlike(align):\n- ```\n         raise ValueError('Horizontal alignment must be numeric or one of %s' % str(legal))\n   self._horizontalalignment = align\n  ```\n  \n   def set_ma(self, align):\n  @@ -811,7 +815,7 @@ class Text(Artist):\n   def set_multialignment(self, align):\n       \"\"\"\n       Set the alignment for multiple lines layout.  The layout of the\n-        bounding box of all the lines is determined bu the horizontalalignment\n-        bounding box of all the lines is determined but the horizontalalignment\n       and verticalalignment properties, but the multiline text within that\n       box can be\n\n@@ -957,11 +961,11 @@ class Text(Artist):\n         \"\"\"\n         Set the vertical alignment\n-        ACCEPTS: [ 'center' | 'top' | 'bottom' | 'baseline' ]\n-        ACCEPTS: [ 'center' | 'top' | 'bottom' | 'baseline' | fraction text height from bottom ]\n       \"\"\"\n       legal = ('top', 'bottom', 'center', 'baseline')\n-        if align not in legal:\n-            raise ValueError('Vertical alignment must be one of %s' % str(legal))\n-        if align not in legal and not is_numlike(align):\n- ```\n         raise ValueError('Vertical alignment must be numeric or one of %s' % str(legal))\n  \n   self._verticalalignment = align\n  ```\n## \n\n1.7.11.4\n\nFrom 076d2ef17d8bb25417ee805a9b9a9221918d230f Mon Sep 17 00:00:00 2001\nFrom: Alexander Heger matplotlib@2sn.net\nDate: Fri, 31 Aug 2012 17:05:23 +1000\nSubject: [PATCH 2/2] BF typo\n\n---\n\n lib/matplotlib/text.py | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py\nindex b1188de..a22dd64 100644\n--- a/lib/matplotlib/text.py\n+++ b/lib/matplotlib/text.py\n@@ -815,7 +815,7 @@ class Text(Artist):\n     def set_multialignment(self, align):\n         \"\"\"\n         Set the alignment for multiple lines layout.  The layout of the\n-        bounding box of all the lines is determined but the horizontalalignment\n-        bounding box of all the lines is determined by the horizontalalignment\n       and verticalalignment properties, but the multiline text within that\n       box can be\n## \n\n1.7.11.4\n","author":{"url":"https://github.com/2sn","@type":"Person","name":"2sn"},"datePublished":"2012-08-31T09:58:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/1180/matplotlib/issues/1180"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:f305675a-1b82-0a40-677d-9f3df2834b1e
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE892:2C9FC7:14ACE4C:1B6435E:6A534A15
html-safe-nonce5e41e8c921d5cbca84c6bc8dc26d914404e7336ce69ce0a357580e6da1a75837
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODkyOjJDOUZDNzoxNEFDRTRDOjFCNjQzNUU6NkE1MzRBMTUiLCJ2aXNpdG9yX2lkIjoiNDk3NzUzMzQ5NDg1MzA2MTE0MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac16836d7dced92a9f397c4144573f0032ce8ee2a664295de03c6e13537d0b5ba5
hovercard-subject-tagissue:6575204
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/1180/issue_layout
twitter:imagehttps://opengraph.githubassets.com/78e89aa0cd3e937688f398d1b3db03a0b6e3e95addf962ed2bde1ad5f2a7894c/matplotlib/matplotlib/issues/1180
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/78e89aa0cd3e937688f398d1b3db03a0b6e3e95addf962ed2bde1ad5f2a7894c/matplotlib/matplotlib/issues/1180
og:image:altHi, I added a quick patch to allow numerical values for text alignment. It now allows a number that is fraction of text hight or with and is measured relative to bottom or left. So ha = 0 == 'left'...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:username2sn
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/1180#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F1180
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%2F1180
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/1180
Reloadhttps://github.com/matplotlib/matplotlib/issues/1180
Reloadhttps://github.com/matplotlib/matplotlib/issues/1180
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/1180
matplotlib https://github.com/matplotlib
matplotlibhttps://github.com/matplotlib/matplotlib
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/1180
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
Text alignmenthttps://github.com/matplotlib/matplotlib/issues/1180#top
https://github.com/2sn
2snhttps://github.com/2sn
on Aug 31, 2012https://github.com/matplotlib/matplotlib/issues/1180#issue-6575204
2sn/matplotlib@master...text-numeric-va-hahttps://github.com/2sn/matplotlib/compare/master...text-numeric-va-ha
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.