swcarpentry / python-novice-gapminder

Plotting and Programming in Python

Home Page:http://swcarpentry.github.io/python-novice-gapminder/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

savefig truncates figure elements

ensatina opened this issue · comments

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.

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?