When work with matplotlib inline backend in ipython notebook, the default behavior is using bbox_inches=\'tight\' to generate the embedded png image internally via savefig()
There's a fuller answer here: Matplotlib and Ipython-notebook: Displaying exactly the figure that will be saved
The trick is to turn off the bbox_inches='tight'
setting in ipython. It's a bit awkward to do temporarily, but just run the IPython magic in a block: %config InlineBackend.print_figure_kwargs = {'bbox_inches':None}
If you want to switch back to the normal way, where axis labels are automatically never cut, you can run %config InlineBackend.print_figure_kwargs = {'bbox_inches':'tight'}
but it has to be after the block where you do the plotting that needs precise bounding boxes.