Title: Pie chart labels out of Figure, even with tight_layout · Issue #4251 · matplotlib/matplotlib · GitHub
Open Graph Title: Pie chart labels out of Figure, even with tight_layout · Issue #4251 · matplotlib/matplotlib
X Title: Pie chart labels out of Figure, even with tight_layout · Issue #4251 · matplotlib/matplotlib
Description: Hi. I'm drawing a pie chart and the labels are cut off of the Figure. I thought this would be solved by tight_layout (as per this issue for instance) but this does not seem to be the case, at least for a pie chart. Below is a code snippe...
Open Graph Description: Hi. I'm drawing a pie chart and the labels are cut off of the Figure. I thought this would be solved by tight_layout (as per this issue for instance) but this does not seem to be the case, at least...
X Description: Hi. I'm drawing a pie chart and the labels are cut off of the Figure. I thought this would be solved by tight_layout (as per this issue for instance) but this does not seem to be the case, at l...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/4251
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Pie chart labels out of Figure, even with tight_layout","articleBody":"Hi.\n\nI'm drawing a pie chart and the labels are cut off of the Figure. I thought this would be solved by tight_layout (as per [this issue](https://github.com/matplotlib/matplotlib/issues/199) for instance) but this does not seem to be the case, at least for a pie chart.\n\nBelow is a code snippet to reproduce. In fact, tight_layout makes it even worse since it ignores the labels and crops tighter to the pie.\n\nIs there a way around this ?\n\nAm I doing things wrong ?\n\n``` python\n# -*- coding: utf-8 -*-\n\nimport sys\n\nfrom PyQt4 import QtGui\n\nfrom matplotlib.figure import Figure\n\nfrom matplotlib.backends.backend_qt4agg import (\n FigureCanvasQTAgg as FigureCanvas)\n\nclass MplCanvas(FigureCanvas):\n \"\"\"Class to represent the FigureCanvas widget\"\"\"\n def __init__(self):\n\n # Setup Matplotlib Figure and Axis\n self.fig = Figure(facecolor=\"white\")\n self.axes = self.fig.add_subplot(111)\n\n # Initialization of the canvas\n super(MplCanvas, self).__init__(self.fig)\n\n # Define the widget as expandable\n FigureCanvas.setSizePolicy(self,\n QtGui.QSizePolicy.Expanding,\n QtGui.QSizePolicy.Expanding)\n\n # Notify the system of updated policy\n FigureCanvas.updateGeometry(self)\n\n # Call tight_layout on resize\n #self.mpl_connect('resize_event', self.fig.tight_layout)\n\nclass MplWidget(QtGui.QWidget):\n \"\"\"Widget defined in Qt Designer\"\"\"\n def __init__(self, parent = None):\n\n super(MplWidget, self).__init__(parent)\n\n # Set canvas and navigation toolbar\n self.canvas = MplCanvas()\n\n # Layout as vertical box\n self.vbl = QtGui.QVBoxLayout()\n self.vbl.addWidget(self.canvas)\n self.setLayout(self.vbl)\n\n\nif __name__ == \"__main__\":\n\n app = QtGui.QApplication(sys.argv)\n\n W = MplWidget()\n\n W.canvas.axes.cla()\n\n values = [0.2, 0.5, 0.3]\n labels = ['label',\n 'looooooog label',\n 'very loooooooooooooooooooooooog label'\n ]\n\n W.canvas.axes.pie(values, labels=labels)\n W.canvas.axes.axis('equal')\n\n W.canvas.fig.tight_layout()\n W.canvas.draw()\n W.show()\n\n sys.exit(app.exec_())\n```\n\nI'm using python 2.7 and Matplotlib 1.4.3~rc1 from Debian experimental.\n","author":{"url":"https://github.com/lafrech","@type":"Person","name":"lafrech"},"datePublished":"2015-03-20T09:53:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/4251/matplotlib/issues/4251"}
| 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:ac8b2b3b-ae94-7474-9454-e8b2f6b94c6d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BCBE:2D857A:288F4B1:378A071:6A53B961 |
| html-safe-nonce | 49acd433d9dc6b57b066f39ed727deebd13294ac26fd93f53ccd36d1a27d40f5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQ0JFOjJEODU3QToyODhGNEIxOjM3OEEwNzE6NkE1M0I5NjEiLCJ2aXNpdG9yX2lkIjoiMjczNzQzMTY1NTk1ODY5MDE0NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d5042504a066decb3e88815c398cb2a7dda8f04b1ebd34f4f173c78d6be63185 |
| hovercard-subject-tag | issue:63199339 |
| 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/4251/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8d74246efa91fd4ca8510d073dabb9ac2f252c95ffe4972fe7a24daf8984ff8e/matplotlib/matplotlib/issues/4251 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8d74246efa91fd4ca8510d073dabb9ac2f252c95ffe4972fe7a24daf8984ff8e/matplotlib/matplotlib/issues/4251 |
| og:image:alt | Hi. I'm drawing a pie chart and the labels are cut off of the Figure. I thought this would be solved by tight_layout (as per this issue for instance) but this does not seem to be the case, at least... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lafrech |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width