-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Pie chart labels out of Figure, even with tight_layout #4251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Minimal code to reproduce: import matplotlib.pyplot as plt
fig, ax = plt.subplots()
values = [0.2, 0.5, 0.3]
labels = ['label',
'looooooog label',
'very loooooooooooooooooooooooog label'
]
ax.pie(values, labels=labels)
ax.axis('equal')
fig.tight_layout()
plt.draw() It is easier for use if your examples use the pyplot interface for managing the figure/axes as the details of the embedding should not matter. This is an interesting pathological example. As I understand it |
Yeah, tight_layout() is specifically designed for preventing overlaps of The feature you are (sort of) looking for is the On Fri, Mar 20, 2015 at 9:49 AM, Thomas A Caswell notifications@github.com
|
I should note that Thomas's intuition is still correct. If there were On Fri, Mar 20, 2015 at 9:58 AM, Benjamin Root ben.root@ou.edu wrote:
|
@WeatherGod It is still doing something here, because there are no tick labels it is expanding the one axes to have the bounding box |
Well, yeah, that's what it is supposed to do. However, it won't resize any Meanwhile, bbox_inches='tight' resizes the figure to accomodate all visible On Fri, Mar 20, 2015 at 10:08 AM, Thomas A Caswell <notifications@github.com
|
(Sorry about the snippet. I didn't figure out about pyplot. Thanks for writing the minimal example.) These concepts are pretty new to me. I searched through the docs, but my understanding of the insides of Matplotlib is close to zero. However, I think WeatherGod is probably right about the parallel with the savefig() function, at least from a user perpective. Ultimately, I'd like to copy the plot to the clipboard to insert it in a document. Currently, I can either
A modification to the savefig() function that would allow saving to clipboard would be a workaround for my use case. Of course, having the plot display correctly in the widget in the first place would be even better. |
You can save to a The internals of mpl are militantly GUI/OS independent so getting clipboard functionality down into savefig may be difficult. |
Right. I get the point (clipboard being GUI dependent, etc.). Thanks for the tip. |
#10682 gets this example closer with |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
This is still a problem, even if you don't use |
Actually I'll close this. This is a case where we don't know the extent of the text until it is draw at the correct location, which we don't know until after a draw. We already document that some cases require |
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 snippet to reproduce. In fact, tight_layout makes it even worse since it ignores the labels and crops tighter to the pie.
Is there a way around this ?
Am I doing things wrong ?
I'm using python 2.7 and Matplotlib 1.4.3~rc1 from Debian experimental.
The text was updated successfully, but these errors were encountered: