The line is a construct. It is not really the function, just a smooth summary of the function. Always keep this in mind.
Recall that we, in fact, generated a sample of points in the input space and corresponding evaluation of those points.
As such, it would be more accurate to create a scatter plot of points; for example:
from numpy import arange
from matplotlib import pyplot
r_min, r_max = -5.0, 5.0
inputs = arange(r_min, r_max, 0.1)
results = objective(inputs)
Running the example creates a scatter plot of the objective function.
We can see the familiar shape of the function, but we don’t gain anything from plotting the points directly.
The line and the smooth interpolation between the points it provides are more useful as we can draw other points on top of the line, such as the location of the optima or the points sampled by an optimization algorithm.