At least for PNG, which I can see in the GitHub diff, there's a lot of whitespace in this figure and it isn't centered in the canvas. Adding the kwarg `bbox_inches='tight'` to the `plt.savefig` call would probably fix all of that and consequently improve the LaTeX layout.