# Testa matplotlib.pyplot. Se https://matplotlib.org/3.1.0/tutorials/ import matplotlib.pyplot as plt # Skapa en lista x=[0, 0.02, 0.04, 0.06, ...] i=0 x=[i] while i<=2: i+=0.02 x.append(i) # Skapa 2 nya listor med kvadraterna och kuberna av x: x_qud = [e*e for e in x] x_cub = [e**3 for e in x] # Matplotlib’s AXES-object manages the content that apperas in the # window. Matplotlib’s FIGURE object manages the window in which # the AXES appear. fig, ax = plt.subplots() ax.grid() plt.plot(x,x, 'm--', linewidth=7, label='linear') plt.plot(x, x_qud, 'cs', label='quadratic') #color='c(yan)', marker=s(quare) plt.plot(x, x_cub, 'y^', label='cubic') #color='y(ellow)', ls=^(triangle) plt.axis([0,2,0,8]) plt.lable('HEJ') plt.xlabel('x values') plt.ylabel('y values') plt.title("Simple Plot") plt.legend() # Skriver ut labels i separat ruta fig.savefig("7_1.png") # Spara bilden plt.show()