APPENDIX

image

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.

Nudge Subplots

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, ...

Get Beginning Python Visualization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.