When you use matplotlib's plot function, it holds an object behind the scenes for you. You can change this object with more calls to
plt and then only once everything has been done should you
plt.show() the graph.
Here is a simply example that does what you want:
In : import matplotlib.pyplot as plt
In : import numpy as np
In : x = np.linspace(0, 10, 100)
In : y = x ** 2
The following lines change the plot object, adding the axes labels - but we don't show it until all are complete...
In : plt.plot(x, y)
Out: [<matplotlib.lines.Line2D at 0x7f3c896bb9b0>]
In : plt.xlabel("Time")
Out: Text(0.5, 0, 'Time')
In : plt.ylabel("Speed")
Out: Text(0, 0.5, 'Speed')
Now we are done, so show it:
In : plt.show()
Have a look here for a more thorough demo, which also shows the object explicitly and lets you better understand what is going on.