This section describes adding horizontal and vertical lines along with adding and tweaking a background grid.
Putting lines in place
Adding horizontal and vertical lines
We will begin by importing our required libraries, as shown:
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline
# Set up figure size and DPI for screen demo
plt.rcParams['figure.figsize'] = (6,4)
plt.rcParams['figure.dpi'] = 150
- We will create the simple sine plot that we saw in Chapter 1, Heavy Customization, as follows:
# Adding a horizontal and vertical line
nums = np.arange(0,10,0.1)
plt.plot(nums, np.sin(nums))
We will get the following output:
- Now, to add an annotation, say, a line that splits...