3.2 Line Chart
A line chart or line graph is a type of chart that displays information as a series of data points called ‘markers’ connected by straight line segments. It is a basic type of chart common in many fields.
x = np.linspace(0, 3, 100)
plt.plot(x, x, label='linear') # Plot 'linear line' on axes.
plt.plot(x, x**2, label='quadratic') # plot 'quadratic line' on the same axes
plt.plot(x, x**3, label='cubic') #etc
plt.xlabel('this is x label') # set the xlabel
plt.ylabel('this is y label') # set the ylabel
plt.title('Multi-lines in one figure') # set the title
plt.legend() # show legend


Last updated
Was this helpful?