Title: [Doc]: matplotlib.axes.Axes.table bbox parameter · Issue #25048 · matplotlib/matplotlib · GitHub
Open Graph Title: [Doc]: matplotlib.axes.Axes.table bbox parameter · Issue #25048 · matplotlib/matplotlib
X Title: [Doc]: matplotlib.axes.Axes.table bbox parameter · Issue #25048 · matplotlib/matplotlib
Description: Documentation Link https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.table.html#matplotlib.axes.Axes.table Problem The documentation states that bbox should be an instance of matplotlib.transforms.Bbox. When I try to use it ...
Open Graph Description: Documentation Link https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.table.html#matplotlib.axes.Axes.table Problem The documentation states that bbox should be an instance of matplotli...
X Description: Documentation Link https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.table.html#matplotlib.axes.Axes.table Problem The documentation states that bbox should be an instance of matplotli...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/25048
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Doc]: matplotlib.axes.Axes.table bbox parameter","articleBody":"### Documentation Link\n\nhttps://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.table.html#matplotlib.axes.Axes.table\n\n### Problem\n\nThe documentation states that `bbox` should be an instance of `matplotlib.transforms.Bbox`.\r\n\r\nWhen I try to use it like this I obtain the following error traceback below using **matplotlib v3.6.2**, whereas it works if I define it as e.g. `bbox=[1, 1, 1, 1]` which I guess (but just because I tried empirically) is equivalent to the method `from_bounds()` of Bbox.\r\n\r\n```python\r\nTypeError Traceback (most recent call last)\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/IPython/core/formatters.py:972, in MimeBundleFormatter.__call__(self, obj, include, exclude)\r\n 969 method = get_real_method(obj, self.print_method)\r\n 971 if method is not None:\r\n--\u003e 972 return method(include=include, exclude=exclude)\r\n 973 return None\r\n 974 else:\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/ipympl/backend_nbagg.py:336, in Canvas._repr_mimebundle_(self, **kwargs)\r\n 333 plaintext = plaintext[:110] + '…'\r\n 335 buf = io.BytesIO()\r\n--\u003e 336 self.figure.savefig(buf, format='png', dpi='figure')\r\n 338 base64_image = b64encode(buf.getvalue()).decode('utf-8')\r\n 339 self._data_url = f'[data:image/png;base64,{](data:image/png;base64,{base64_image)[base64_image](data:image/png;base64,{base64_image)}'\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/figure.py:3274, in Figure.savefig(self, fname, transparent, **kwargs)\r\n 3270 for ax in self.axes:\r\n 3271 stack.enter_context(\r\n 3272 ax.patch._cm_set(facecolor='none', edgecolor='none'))\r\n-\u003e 3274 self.canvas.print_figure(fname, **kwargs)\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/backend_bases.py:2338, in FigureCanvasBase.print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)\r\n 2334 try:\r\n 2335 # _get_renderer may change the figure dpi (as vector formats\r\n 2336 # force the figure dpi to 72), so we need to set it again here.\r\n 2337 with cbook._setattr_cm(self.figure, dpi=dpi):\r\n-\u003e 2338 result = print_method(\r\n 2339 filename,\r\n 2340 facecolor=facecolor,\r\n 2341 edgecolor=edgecolor,\r\n 2342 orientation=orientation,\r\n 2343 bbox_inches_restore=_bbox_inches_restore,\r\n 2344 **kwargs)\r\n 2345 finally:\r\n 2346 if bbox_inches and restore_bbox:\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/backend_bases.py:2204, in FigureCanvasBase._switch_canvas_and_return_print_method.\u003clocals\u003e.\u003clambda\u003e(*args, **kwargs)\r\n 2200 optional_kws = { # Passed by print_figure for other renderers.\r\n 2201 \"dpi\", \"facecolor\", \"edgecolor\", \"orientation\",\r\n 2202 \"bbox_inches_restore\"}\r\n 2203 skip = optional_kws - {*inspect.signature(meth).parameters}\r\n-\u003e 2204 print_method = functools.wraps(meth)(lambda *args, **kwargs: meth(\r\n 2205 *args, **{k: v for k, v in kwargs.items() if k not in skip}))\r\n 2206 else: # Let third-parties do as they see fit.\r\n 2207 print_method = meth\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/_api/deprecation.py:410, in delete_parameter.\u003clocals\u003e.wrapper(*inner_args, **inner_kwargs)\r\n 400 deprecation_addendum = (\r\n 401 f\"If any parameter follows {name!r}, they should be passed as \"\r\n 402 f\"keyword, not positionally.\")\r\n 403 warn_deprecated(\r\n 404 since,\r\n 405 name=repr(name),\r\n (...)\r\n 408 else deprecation_addendum,\r\n 409 **kwargs)\r\n--\u003e 410 return func(*inner_args, **inner_kwargs)\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/backends/backend_agg.py:517, in FigureCanvasAgg.print_png(self, filename_or_obj, metadata, pil_kwargs, *args)\r\n 468 @_api.delete_parameter(\"3.5\", \"args\")\r\n 469 def print_png(self, filename_or_obj, *args,\r\n 470 metadata=None, pil_kwargs=None):\r\n 471 \"\"\"\r\n 472 Write the figure to a PNG file.\r\n 473 \r\n (...)\r\n 515 *metadata*, including the default 'Software' key.\r\n 516 \"\"\"\r\n--\u003e 517 self._print_pil(filename_or_obj, \"png\", pil_kwargs, metadata)\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/backends/backend_agg.py:463, in FigureCanvasAgg._print_pil(self, filename_or_obj, fmt, pil_kwargs, metadata)\r\n 458 def _print_pil(self, filename_or_obj, fmt, pil_kwargs, metadata=None):\r\n 459 \"\"\"\r\n 460 Draw the canvas, then save it using `.image.imsave` (to which\r\n 461 *pil_kwargs* and *metadata* are forwarded).\r\n 462 \"\"\"\r\n--\u003e 463 FigureCanvasAgg.draw(self)\r\n 464 mpl.image.imsave(\r\n 465 filename_or_obj, self.buffer_rgba(), format=fmt, origin=\"upper\",\r\n 466 dpi=self.figure.dpi, metadata=metadata, pil_kwargs=pil_kwargs)\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/backends/backend_agg.py:405, in FigureCanvasAgg.draw(self)\r\n 401 # Acquire a lock on the shared font cache.\r\n 402 with RendererAgg.lock, \\\r\n 403 (self.toolbar._wait_cursor_for_draw_cm() if self.toolbar\r\n 404 else nullcontext()):\r\n--\u003e 405 self.figure.draw(self.renderer)\r\n 406 # A GUI class may be need to update a window using this draw, so\r\n 407 # don't forget to call the superclass.\r\n 408 super().draw()\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/artist.py:74, in _finalize_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer, *args, **kwargs)\r\n 72 @wraps(draw)\r\n 73 def draw_wrapper(artist, renderer, *args, **kwargs):\r\n---\u003e 74 result = draw(artist, renderer, *args, **kwargs)\r\n 75 if renderer._rasterizing:\r\n 76 renderer.stop_rasterizing()\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/artist.py:51, in allow_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer)\r\n 48 if artist.get_agg_filter() is not None:\r\n 49 renderer.start_filter()\r\n---\u003e 51 return draw(artist, renderer)\r\n 52 finally:\r\n 53 if artist.get_agg_filter() is not None:\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/figure.py:3071, in Figure.draw(self, renderer)\r\n 3068 # ValueError can occur when resizing a window.\r\n 3070 self.patch.draw(renderer)\r\n-\u003e 3071 mimage._draw_list_compositing_images(\r\n 3072 renderer, self, artists, self.suppressComposite)\r\n 3074 for sfig in self.subfigs:\r\n 3075 sfig.draw(renderer)\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/image.py:131, in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)\r\n 129 if not_composite or not has_images:\r\n 130 for a in artists:\r\n--\u003e 131 a.draw(renderer)\r\n 132 else:\r\n 133 # Composite any adjacent images together\r\n 134 image_group = []\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/artist.py:51, in allow_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer)\r\n 48 if artist.get_agg_filter() is not None:\r\n 49 renderer.start_filter()\r\n---\u003e 51 return draw(artist, renderer)\r\n 52 finally:\r\n 53 if artist.get_agg_filter() is not None:\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/axes/_base.py:3107, in _AxesBase.draw(self, renderer)\r\n 3104 a.draw(renderer)\r\n 3105 renderer.stop_rasterizing()\r\n-\u003e 3107 mimage._draw_list_compositing_images(\r\n 3108 renderer, self, artists, self.figure.suppressComposite)\r\n 3110 renderer.close_group('axes')\r\n 3111 self.stale = False\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/image.py:131, in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)\r\n 129 if not_composite or not has_images:\r\n 130 for a in artists:\r\n--\u003e 131 a.draw(renderer)\r\n 132 else:\r\n 133 # Composite any adjacent images together\r\n 134 image_group = []\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/artist.py:51, in allow_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer)\r\n 48 if artist.get_agg_filter() is not None:\r\n 49 renderer.start_filter()\r\n---\u003e 51 return draw(artist, renderer)\r\n 52 finally:\r\n 53 if artist.get_agg_filter() is not None:\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/table.py:409, in Table.draw(self, renderer)\r\n 407 return\r\n 408 renderer.open_group('table', gid=self.get_gid())\r\n--\u003e 409 self._update_positions(renderer)\r\n 411 for key in sorted(self._cells):\r\n 412 self._cells[key].draw(renderer)\r\n\r\nFile ~/Applications/mambaforge/envs/swgo-plot/lib/python3.9/site-packages/matplotlib/table.py:598, in Table._update_positions(self, renderer)\r\n 594 l, b, w, h = bbox.bounds\r\n 596 if self._bbox is not None:\r\n 597 # Position according to bbox\r\n--\u003e 598 rl, rb, rw, rh = self._bbox\r\n 599 self.scale(rw / w, rh / h)\r\n 600 ox = rl - l\r\n\r\nTypeError: cannot unpack non-iterable Bbox object\r\nCanvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous view', 'arrow-left', 'back'), ('Forward', 'Forward to next view', 'arrow-right', 'forward'), ('Pan', 'Left button pans, Right button zooms\\nx/y fixes axis, CTRL fixes aspect', 'arrows', 'pan'), ('Zoom', 'Zoom to rectangle\\nx/y fixes axis', 'square-o', 'zoom'), ('Download', 'Download plot', 'floppy-o', 'save_figure')]))\r\n```\n\n### Suggested improvement\n\nEither let the parameter be a proper BBox (my suggestion) or specify that the usage is that of `from_bounds()`","author":{"url":"https://github.com/HealthyPear","@type":"Person","name":"HealthyPear"},"datePublished":"2023-01-21T07:03:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/25048/matplotlib/issues/25048"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b06808de-8645-e146-9dc7-fc67c9709665 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E078:28E279:AA7B0A8:ADE3EE4:6A50B164 |
| html-safe-nonce | e470d031325f98f7010c505078a433d9f94d2015bc6538e6e85efb7b7e5cde02 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMDc4OjI4RTI3OTpBQTdCMEE4OkFERTNFRTQ6NkE1MEIxNjQiLCJ2aXNpdG9yX2lkIjoiMjk2OTc0MzY3OTYzMDEyNzQ2MCIsInJlZ2lvbl9lZGdlIjoic2VhIiwicmVnaW9uX3JlbmRlciI6InNlYSJ9 |
| visitor-hmac | ad0cb141f13c40c5c7bb11cdf24543debda86c3e351521e0892958bd3033a5d7 |
| hovercard-subject-tag | issue:1551719853 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/25048/issue_layout |
| twitter:image | https://opengraph.githubassets.com/21e5f3ec2defce17cf1b38058c29bdb7e427034e6e91d280486bfdb13674d892/matplotlib/matplotlib/issues/25048 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/21e5f3ec2defce17cf1b38058c29bdb7e427034e6e91d280486bfdb13674d892/matplotlib/matplotlib/issues/25048 |
| og:image:alt | Documentation Link https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.table.html#matplotlib.axes.Axes.table Problem The documentation states that bbox should be an instance of matplotli... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | HealthyPear |
| hostname | github.com |
| expected-hostname | github.com |
| None | d6dc8294eb500fa36bbc57472d61fe87c522f9c3c1d64f70f4926f66a66a7efb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7ac0ad2f2c7e4b9056617355fd9e33e22b0c8df9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width