Line plots connect data points with lines. Why does this help us see trends in data?
Think about how connecting points helps you notice if values go up or down.
Lines connect points in order, making it easy to see if values increase, decrease, or stay steady, which reveals trends.
What is the y-values array plotted by this code?
import matplotlib.pyplot as plt x = [1, 2, 3, 4] y = [10, 15, 13, 17] plt.plot(x, y) plt.show() print(y)
Look at the variable used as y-values in plt.plot.
The y-values array is the second argument in plt.plot, which is [10, 15, 13, 17].
Given this data, what trend does the line plot show?
x = [1, 2, 3, 4, 5] y = [5, 7, 9, 11, 13]
Look at how y changes as x increases.
Y increases by 2 each time x increases by 1, showing a steady upward trend.
What is wrong with this code that makes the line plot not show a clear trend?
import matplotlib.pyplot as plt x = [1, 2, 3, 4] y = [10, 5, 15, 7] plt.plot(y, x) plt.show()
Check the order of arguments in plt.plot(x, y).
Swapping x and y reverses axes, making the trend hard to interpret.
You want to show how temperature changes during a day. Which data set is best for a line plot to show the trend?
Think about data ordered by time to show smooth changes.
Data ordered by time with regular intervals shows trends clearly in line plots.