Chart Axes on Python (Matplotlib) - CLASS 4

Publié le: 05 septembre 2022
sur la chaîne: Fala tu, Nerd!
32
6

Learn how to plot a chart with Python!

Main code:
import matplotlib.pyplot as plt

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

labels = [1, 2, 3, 4]
time = [1, 2, 3, 4]
strength = [2, 3, 5, 11]

ax.plot(time, strength, 'r-s', label = 'Plot')
for i in range(len(time)):
ax.text(time[i]-0.15, strength[i]+0.2, '{}' .format(strength[i]))

ax.set_title('Class 4')
ax.set_xlabel('Time')
ax.set_ylabel('Strength')
ax.legend()
ax.grid()

a = ['a', 'b', 'c', 'd']
plt.xticks([1, 2, 3, 4], a)

b = ['a', 'b', 'c', 'd', 'e', 'f']
plt.yticks([1, 3, 5, 7, 9, 11], b)

plt.show()


Sur cette page du site, vous pouvez voir la vidéo en ligne Chart Axes on Python (Matplotlib) - CLASS 4 durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Fala tu, Nerd! 05 septembre 2022, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 32 fois et il a aimé 6 téléspectateurs. Bon visionnage!