Python MatplotlibLesson 59Free preview
Matplotlib Plotting
This lesson is part of Python · All levels
Summary
Each minimal line graph requires two sets of values, namely the x-axis and the y-axis. plt.plot() can also accept short string formats such as 'r--' or 'g:o' that combine color, line style, and marker in one argument. We can draw several lines at once by calling plot() repeatedly or by giving more than two lists of data. This ability is useful for comparing multiple data sets in one view.
Key points
- Line graphs require the value of the x-axis and the y-axis
- String formats like 'r--' set the color and line style.
- Several sets of data can be drawn in one figure.
- Legend with plt.legend() helps distinguish each line
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.