4.2 Matplotlib
In [1]:
import matplotlib.pyplot as plt
import numpy as np
plt.rcParams['figure.figsize'] = [6, 3]
x = np.array([0, 10])
y = np.array([0, 25])
plt.plot(x, y)
plt.show()In [2]:
plt.plot(x, y, 'o')[<matplotlib.lines.Line2D at 0x7b0893b64b50>]
In [3]:
x = np.array([0, 10, 14])
y = np.array([0, 25, 32])
plt.plot(x, y, marker = 'o', ms = 10, mec = 'b', mfc = 'b', linestyle = 'dashed')
plt.show()In [4]:
y1 = np.array([0, 10, 14])
y2 = np.array([3, 25, 32])
plt.plot(y1)
plt.plot(y2)
plt.show()In [5]:
y1 = np.array([0, 10, 14])
y2 = np.array([3, 25, 32])
plt.plot(y1)
plt.plot(y2)
plt.xlabel("Etichetta asse X")
plt.ylabel("Etichetta asse Y")
plt.title("Il mio grafico")
plt.grid()
plt.show()In [6]:
y1 = np.array([0, 10, 14])
y2 = np.array([3, 25, 32])
plt.subplot(1, 2, 1)
plt.plot(y1)
plt.subplot(1, 2, 2)
plt.plot(y2)
plt.show()In [7]:
y1 = np.array([0, 10, 14])
y2 = np.array([3, 25, 32])
plt.subplot(2, 1, 1)
plt.plot(y1)
plt.subplot(2, 1, 2)
plt.plot(y2)
plt.show()