Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #%% Due plot uno sopra l'altro [subplots]
- # Ritorna un oggetto figura e un array di assi, uno per ogni plot
- fig, axs = plt.subplots(2, 1, sharex=True)
- # Remove horizontal space between axes
- fig.subplots_adjust(hspace=0)
- # Imposto la dimensione
- fig.set_size_inches(12,5)
- fig.suptitle("Titolo", fontsize=16)
- # Mostro la griglia
- axs[0].grid()
- axs[1].grid()
- # Imposto asse x e y (Nota: x รจ condiviso)
- axs[0].set_xlabel("Frequenza (Hz)",fontsize=14)
- axs[0].set_ylabel("Ampiezza (V)",fontsize=14)
- # Plotto dei dati
- axs[0].plot(time,v1, label='Generatore', color='y')
- axs[0].plot(time,v2, label='Segnale filtrato', color='b')
- # Mostro la legenda
- axs[0].legend(fontsize=14) # <--- note the default location "best"
- # Va dato sempre per mostrare tutte le figure esistenti
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement