Python MatplotlibLesson 58Free preview
Matplotlib Pyplot
This lesson is part of Python · All levels
Summary
The pyplot module works with a state-based pattern: each function called influences the active figure that is being opened. The main function plt.plot() draws a line graph from two lists of values, and can be called many times to add several lines in a single figure. In addition to drawing, the pyplot also provides the function of adding a title and an axis label to make the graphics readable. Understanding these patterns makes the layout of the graph systematic and easy to clean.
Key points
- Pyplot manages the active figure automatically (state-based)
- Plt.plot(x, y) Draw a line based on the value pair
- Several plt.plot() in a block produce several lines
- The headline and axis labels are added to make the graphics easy to read
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.