-
-
Notifications
You must be signed in to change notification settings - Fork 430
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
savefig truncates figure elements #638
Comments
Hi @ensatina, indeed what you did there is correct. Matplotlib unfortunately has default options that are not always great. Are you suggesting we add that argument to the lesson? Personally I would rather keep it simple to avoid lengthy explanations in the course of the workshops. As your own case suggests, it is possible to debug that problem with a bit of googling in case it arises for a learner after the workshop. What do you think? |
A common way is to include the function call fig.tight_layout(), which
probably results in something similar. One could put this before a
fig.savefig in the example and a short one-sentenace comment will suffice.
…On Thu, May 18, 2023 at 3:08 PM Martino Sorbaro ***@***.***> wrote:
Hi @ensatina <https://github.com/ensatina>, indeed what you did there is
correct. Matplotlib unfortunately has default options that are not always
great.
Are you suggesting we add that argument to the lesson? Personally I would
rather keep it simple to avoid lengthy explanations in the course of the
workshops. As your own case suggests, it is possible to debug that problem
with a bit of googling in case it arises for a learner after the workshop.
What do you think?
—
Reply to this email directly, view it on GitHub
<#638 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABLLJBLSPNW42MPXWNO4O33XGYNOHANCNFSM6AAAAAAX4KWM3Y>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
In the examples for using the savefig() function on page 9 [Please](http://swcarpentry.github.io/python-novice-gapminder/09-plotting.html), the exported figures truncate axis labels.
Is there an easy (appropriate level) modification that could be added so the full figures export? I'm new to Python and this immediately sent me away from the lesson to troubleshoot, so I think it would be good if the code in the lesson exported full figures.
I ended up adding the argument
bbox_inches = "tight"
but I don't know what it means or if there is a better way to do this.
The text was updated successfully, but these errors were encountered: