Let's start by importing everything we need:
import numpy as npimport matplotlib as mplimport matplotlib.pyplot as plt%matplotlib inline# Set up figure size and DPI for screen demoplt.rcParams['figure.figsize'] = (6,4)plt.rcParams['figure.dpi'] = 150
- Next, bring up the standard sine curve that we have been using:
# Add some textnums = np.arange(0,10,0.1)plt.plot(nums, np.sin(nums))
We will get the following output:
- We will add some text, say, right in the middle of the two curves. We will use the text method, and since we are taking the data coordinates, the middle of this plot would be (5, ...