Setting up the notebook for plotting with matplotlib

Importing Matplotlib

First we need to import pyplot, a collection of command style functions that make matplotlib work like MATLAB. Let's, as well, use the magic command %matplotlib inline in order to display the figures in the notebook

import matplotlib.pyplot as plt
%matplotlib inline

# this doubles image size, but we'll do it manually below
# %config InlineBackend.figure_format = 'retina'

The following parameters are recommended for matplotlib, they will make matplotlib output a better quality image

# %load snippets/matplot_setup.py
plt.rcParams['savefig.dpi'] = 300
plt.rcParams['figure.dpi'] = 163

plt.rcParams['figure.autolayout'] = False
plt.rcParams['figure.figsize'] = 20, 12
plt.rcParams['axes.labelsize'] = 18
plt.rcParams['axes.titlesize'] = 20
plt.rcParams['font.size'] = 16
plt.rcParams['lines.linewidth'] = 2.0
plt.rcParams['lines.markersize'] = 8
plt.rcParams['legend.fontsize'] = 14

plt.rcParams['text.usetex'] = False # True activates latex output in fonts!
plt.rcParams['font.family'] = "serif"
plt.rcParams['font.serif'] = "cm"
plt.rcParams['text.latex.preamble'] = "\\usepackage{subdepth}, \\usepackage{type1cm}"

You can change the second line in order to fit your display. 163 dpi corresponds to a Dell Ultra HD 4k P2715Q. You can check your screen's dpi count at http://dpi.lv/