Additional Source Listing
This appendix is a collection of source listings that didn’t quite belong in the chapters themselves, but nevertheless might be of interest to you.
In generating subplots of size 2 by 2 for this book, I noticed that the text for the x-axis of the top subplots clashes with the titles of the lower subplots. To overcome this, I defined nudge_subplot(), a function designed to modify the location of subplots within a figure (see Listing A-1).
Listing A-1. Source Listing of nudge_subplot()
def nudge_subplot(sp, dy): """A helper function to move subplots.""" sp_ax = sp.get_position() sp.set_position([sp_ax.x0, ...