3.2 Line Chart
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