René's URL Explorer Experiment


Title: [Bug]: Inset Axes Failing for Geographic Plot · Issue #29720 · matplotlib/matplotlib · GitHub

Open Graph Title: [Bug]: Inset Axes Failing for Geographic Plot · Issue #29720 · matplotlib/matplotlib

X Title: [Bug]: Inset Axes Failing for Geographic Plot · Issue #29720 · matplotlib/matplotlib

Description: Bug summary I'm trying to work with the inset_axes() function for the first time, using geographic data plotted with matplotlib and CartoPy, but have been running into a variety of issues. For simplicity's sake, point #3 on #29174 is a g...

Open Graph Description: Bug summary I'm trying to work with the inset_axes() function for the first time, using geographic data plotted with matplotlib and CartoPy, but have been running into a variety of issues. For simp...

X Description: Bug summary I'm trying to work with the inset_axes() function for the first time, using geographic data plotted with matplotlib and CartoPy, but have been running into a variety of issues. For ...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Inset Axes Failing for Geographic Plot","articleBody":"### Bug summary\n\nI'm trying to work with the `inset_axes()` function for the first time, using geographic data plotted with matplotlib and CartoPy, but have been running into a variety of issues. For simplicity's sake, point #3 on #29174 is a good representation of what I am trying to do (recreated below).\n\n### Code for reproduction\n\n```Python\nimport matplotlib.pyplot as plt\nimport cartopy.crs as ccrs\nimport cartopy.feature as cfeature\n\nmain_map_proj = ccrs.TransverseMercator()\npcarree = ccrs.PlateCarree()\n\nfig, ax = plt.subplots(subplot_kw={\"projection\": main_map_proj})\n\nax.set_extent([-50, 15, 50, 70], crs=pcarree)\nax.add_feature(cfeature.OCEAN.with_scale('50m'), facecolor=\"lightsteelblue\", zorder=1,\n               edgecolor=\"k\", lw=0.2)\n\ninset_ax = ax.inset_axes((0.05, 0.05, 0.3, 0.3), projection=pcarree)\n\ninset_extent = [-44, -38, 63, 66]\ninset_ax.set_extent(inset_extent, crs=pcarree)\ninset_ax.add_feature(cfeature.OCEAN, facecolor=\"lightsteelblue\", zorder=1)\n\nax.indicate_inset_zoom(inset_ax, edgecolor=\"black\", transform=pcarree)\n\nx = [inset_extent[0], inset_extent[1], inset_extent[1], inset_extent[0]]\ny = [inset_extent[2], inset_extent[2], inset_extent[3], inset_extent[3]]\nfor a in ax, inset_ax:\n    a.scatter(x, y, c=range(4), s=150, transform=pcarree)\n\nplt.show()\n```\n\n### Actual outcome\n\n`ValueError: Axes should be an instance of GeoAxes, got \u003cclass 'NoneType'\u003e`.\n\nThis is happening even though I am verifying that both `ax` and `inset_ax` are GeoAxes using `type()`.\n\n### Expected outcome\n\n![Image](https://github.com/user-attachments/assets/d082425f-ce1b-403e-aa1f-6e482d8b034d)\n\n### Additional information\n\nI am posting this in matplotlib as it _seems_ to be more of an issue with the `inset_axes()` function rather than the `GeoAxes` class.\n\n\u003cdetails\u003e\n\u003csummary\u003eFull Stack Trace \u003e\u003c/summary\u003e\n\n```py\n---------------------------------------------------------------------------\nValueError                                Traceback (most recent call last)\nFile \\personalpath\\to\\env\\site-packages\\IPython\\core\\formatters.py:402, in BaseFormatter.__call__(self, obj)\n    400     pass\n    401 else:\n--\u003e 402     return printer(obj)\n    403 # Finally look for special method names\n    404 method = get_real_method(obj, self.print_method)\n\nFile \\personalpath\\to\\env\\site-packages\\IPython\\core\\pylabtools.py:170, in print_figure(fig, fmt, bbox_inches, base64, **kwargs)\n    167     from matplotlib.backend_bases import FigureCanvasBase\n    168     FigureCanvasBase(fig)\n--\u003e 170 fig.canvas.print_figure(bytes_io, **kw)\n    171 data = bytes_io.getvalue()\n    172 if fmt == 'svg':\n\nFile \\personalpath\\to\\env\\site-packages\\matplotlib\\backend_bases.py:2155, in FigureCanvasBase.print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)\n   2152     # we do this instead of `self.figure.draw_without_rendering`\n   2153     # so that we can inject the orientation\n   2154     with getattr(renderer, \"_draw_disabled\", nullcontext)():\n-\u003e 2155         self.figure.draw(renderer)\n   2156 if bbox_inches:\n   2157     if bbox_inches == \"tight\":\n\nFile \\personalpath\\to\\env\\site-packages\\matplotlib\\artist.py:94, in _finalize_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer, *args, **kwargs)\n     92 @wraps(draw)\n     93 def draw_wrapper(artist, renderer, *args, **kwargs):\n---\u003e 94     result = draw(artist, renderer, *args, **kwargs)\n     95     if renderer._rasterizing:\n     96         renderer.stop_rasterizing()\n\nFile \\personalpath\\to\\env\\site-packages\\matplotlib\\artist.py:71, in allow_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer)\n     68     if artist.get_agg_filter() is not None:\n     69         renderer.start_filter()\n---\u003e 71     return draw(artist, renderer)\n     72 finally:\n     73     if artist.get_agg_filter() is not None:\n\nFile \\personalpath\\to\\env\\site-packages\\matplotlib\\figure.py:3257, in Figure.draw(self, renderer)\n   3254             # ValueError can occur when resizing a window.\n   3256     self.patch.draw(renderer)\n-\u003e 3257     mimage._draw_list_compositing_images(\n   3258         renderer, self, artists, self.suppressComposite)\n   3260     renderer.close_group('figure')\n   3261 finally:\n\nFile \\personalpath\\to\\env\\site-packages\\matplotlib\\image.py:134, in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)\n    132 if not_composite or not has_images:\n    133     for a in artists:\n--\u003e 134         a.draw(renderer)\n    135 else:\n    136     # Composite any adjacent images together\n    137     image_group = []\n\nFile \\personalpath\\to\\env\\site-packages\\matplotlib\\artist.py:71, in allow_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer)\n     68     if artist.get_agg_filter() is not None:\n     69         renderer.start_filter()\n---\u003e 71     return draw(artist, renderer)\n     72 finally:\n     73     if artist.get_agg_filter() is not None:\n\nFile \\personalpath\\to\\env\\site-packages\\cartopy\\mpl\\geoaxes.py:524, in GeoAxes.draw(self, renderer, **kwargs)\n    519         self.imshow(img, extent=extent, origin=origin,\n    520                     transform=factory.crs, *factory_args[1:],\n    521                     **factory_kwargs)\n    522 self._done_img_factory = True\n--\u003e 524 return super().draw(renderer=renderer, **kwargs)\n\nFile \\personalpath\\to\\env\\site-packages\\matplotlib\\artist.py:71, in allow_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer)\n     68     if artist.get_agg_filter() is not None:\n     69         renderer.start_filter()\n---\u003e 71     return draw(artist, renderer)\n     72 finally:\n     73     if artist.get_agg_filter() is not None:\n\nFile \\personalpath\\to\\env\\site-packages\\matplotlib\\axes\\_base.py:3210, in _AxesBase.draw(self, renderer)\n   3207 if artists_rasterized:\n   3208     _draw_rasterized(self.get_figure(root=True), artists_rasterized, renderer)\n-\u003e 3210 mimage._draw_list_compositing_images(\n   3211     renderer, self, artists, self.get_figure(root=True).suppressComposite)\n   3213 renderer.close_group('axes')\n   3214 self.stale = False\n\nFile \\personalpath\\to\\env\\site-packages\\matplotlib\\image.py:134, in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)\n    132 if not_composite or not has_images:\n    133     for a in artists:\n--\u003e 134         a.draw(renderer)\n    135 else:\n    136     # Composite any adjacent images together\n    137     image_group = []\n\nFile \\personalpath\\to\\env\\site-packages\\matplotlib\\artist.py:38, in _prevent_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer, *args, **kwargs)\n     35     renderer.stop_rasterizing()\n     36     renderer._rasterizing = False\n---\u003e 38 return draw(artist, renderer, *args, **kwargs)\n\nFile \\personalpath\\to\\env\\site-packages\\matplotlib\\inset.py:230, in InsetIndicator.draw(self, renderer)\n    226 conn_same_style = []\n    228 # Figure out which connectors have the same style as the box, so should\n    229 # be drawn as a single path.\n--\u003e 230 for conn in self.connectors or []:\n    231     if conn.get_visible():\n    232         drawn = False\n\nFile \\personalpath\\to\\env\\site-packages\\matplotlib\\inset.py:221, in InsetIndicator.connectors(self)\n    219 if self._auto_update_bounds:\n    220     self._rectangle.set_bounds(self._bounds_from_inset_ax())\n--\u003e 221 self._update_connectors()\n    222 return tuple(self._connectors)\n\nFile \\personalpath\\to\\env\\site-packages\\matplotlib\\inset.py:192, in InsetIndicator._update_connectors(self)\n    189 pos = self._inset_ax.get_position()\n    190 bboxins = pos.transformed(self.get_figure(root=False).transSubfigure)\n    191 rectbbox = transforms.Bbox.from_bounds(x, y, width, height).transformed(\n--\u003e 192     self._rectangle.get_transform())\n    193 x0 = rectbbox.x0 \u003c bboxins.x0\n    194 x1 = rectbbox.x1 \u003c bboxins.x1\n\nFile \\personalpath\\to\\env\\site-packages\\matplotlib\\patches.py:309, in Patch.get_transform(self)\n    307 def get_transform(self):\n    308     \"\"\"Return the `~.transforms.Transform` applied to the `Patch`.\"\"\"\n--\u003e 309     return self.get_patch_transform() + artist.Artist.get_transform(self)\n\nFile \\personalpath\\to\\env\\site-packages\\matplotlib\\artist.py:454, in Artist.get_transform(self)\n    451     self._transform = IdentityTransform()\n    452 elif (not isinstance(self._transform, Transform)\n    453       and hasattr(self._transform, '_as_mpl_transform')):\n--\u003e 454     self._transform = self._transform._as_mpl_transform(self.axes)\n    455 return self._transform\n\nFile \\personalpath\\to\\env\\site-packages\\cartopy\\crs.py:267, in CRS._as_mpl_transform(self, axes)\n    265 import cartopy.mpl.geoaxes as geoaxes\n    266 if not isinstance(axes, geoaxes.GeoAxes):\n--\u003e 267     raise ValueError(\n    268         'Axes should be an instance of GeoAxes, got %s' % type(axes)\n    269     )\n    270 return (\n    271     geoaxes.InterProjectionTransform(self, axes.projection) +\n    272     axes.transData\n    273 )\n\nValueError: Axes should be an instance of GeoAxes, got \u003cclass 'NoneType'\u003e\n```\n\n\u003c/details\u003e\n\n### Operating system\n\n_No response_\n\n### Matplotlib Version\n\n3.10.1\n\n### Matplotlib Backend\n\n_No response_\n\n### Python version\n\n3.12.9\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\nconda","author":{"url":"https://github.com/moss-xyz","@type":"Person","name":"moss-xyz"},"datePublished":"2025-03-09T03:59:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/29720/matplotlib/issues/29720"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:015a6fe8-ed86-40c9-eb01-94b499062102
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDB58:1BDDAE:2825B:35870:6A523F8B
html-safe-noncecd32fd30128dfef37fddaf3bf73df8707c6969cef4885777b21c76b47d478f01
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjU4OjFCRERBRToyODI1QjozNTg3MDo2QTUyM0Y4QiIsInZpc2l0b3JfaWQiOiIzMzc2Mjk4MDAzOTAwMDIyNjY3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmace548a5e783164d568e71a0fb2b1038fc01fbfbba5cd8351dc18708835bf07d8f
hovercard-subject-tagissue:2905183858
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/29720/issue_layout
twitter:imagehttps://opengraph.githubassets.com/62523e896d428a4d9f327bed4ac55ea5b01621b50968edf8bf06dd6132ddc50c/matplotlib/matplotlib/issues/29720
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/62523e896d428a4d9f327bed4ac55ea5b01621b50968edf8bf06dd6132ddc50c/matplotlib/matplotlib/issues/29720
og:image:altBug summary I'm trying to work with the inset_axes() function for the first time, using geographic data plotted with matplotlib and CartoPy, but have been running into a variety of issues. For simp...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemoss-xyz
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
release7aed05249554b889eb33d002851a973eebcc7e91
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/matplotlib/matplotlib/issues/29720#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F29720
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%2F29720
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/29720
Reloadhttps://github.com/matplotlib/matplotlib/issues/29720
Reloadhttps://github.com/matplotlib/matplotlib/issues/29720
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/29720
matplotlib https://github.com/matplotlib
matplotlibhttps://github.com/matplotlib/matplotlib
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/29720
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 409 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
[Bug]: Inset Axes Failing for Geographic Plothttps://github.com/matplotlib/matplotlib/issues/29720#top
v3.11.0https://github.com/matplotlib/matplotlib/milestone/96
https://github.com/moss-xyz
moss-xyzhttps://github.com/moss-xyz
on Mar 9, 2025https://github.com/matplotlib/matplotlib/issues/29720#issue-2905183858
#3https://github.com/matplotlib/matplotlib/pull/3
#29174https://github.com/matplotlib/matplotlib/pull/29174
https://private-user-images.githubusercontent.com/43250672/420641340-d082425f-ce1b-403e-aa1f-6e482d8b034d.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODM3NzU0MTYsIm5iZiI6MTc4Mzc3NTExNiwicGF0aCI6Ii80MzI1MDY3Mi80MjA2NDEzNDAtZDA4MjQyNWYtY2UxYi00MDNlLWFhMWYtNmU0ODJkOGIwMzRkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA3MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNzExVDEzMDUxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA3ZDI4ODUzMDQ3NWUyOWQxMDUxMGI1MjY2MTczODQ1ZmQyZjYyZDRiNWIzNjM2NDRhNDNhZTA3NTJiNzM1MGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.R6LtDKdiKrlPYjkA0RK7bwE3rbv2folr6o8cRFSkzDY
v3.11.0https://github.com/matplotlib/matplotlib/milestone/96
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.