Line plot

After importing matplotlib.pyplot as plt, we draw line plots with the plt.plot() command.

Here is a code snippet for a simple example of plotting the temperature of the week:

# Import the Matplotlib moduleimport matplotlib.pyplot as plt# Use a list to store the daily temperaturet = [22.2,22.3,22.5,21.8,22.5,23.4,22.8]# Plot the daily temperature t as a line plotplt.plot(t)# Show the

After you run the code, the following plot will be displayed as the output in the notebook cell:

When a single parameter is parsed, the data values are assumed to be on the y axis, with the indices on the x axis.

Remember to conclude each ...

Get Matplotlib for Python Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.