“plt.xticks” Réponses codées

plt.xticks

# Show x axes with intervals of X instead of default (this case default=5)
import numpy as np
import matplotlib.pyplot as plt

x = [0,5,9,10,15]
y = [0,1,2,3,4]
X = 1.0
plt.plot(x,y)
plt.xticks(np.arange(min(x), max(x)+1, X))
plt.show()
Sugared Bun

Modification des étiquettes de l'axe Matplotlib

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

labels = [item.get_text() for item in ax.get_xticklabels()]
labels[1] = 'Testing'

ax.set_xticklabels(labels)
Exuberant Eel

xticks et yticks matplotlib

#x-ticks: 
plt.xticks(start, stop, step))
#y-ticks:
plt.yticks(np.arange(start,stop,step))
M.U

changer xticks python

plt.xticks(np.arange(0,10),np.arange(10,20))
Tremendous Enceladus

étiquette xticks matplotlib

ax.set_xticks(np.arange(len(data)))
ax.set_xticklabels(labels)
Difficult Dormouse

plt.xticks

# Show x axes with intervals of X instead of default (this case default=5)
import numpy as np
import matplotlib.pyplot as plt

x = [0,5,9,10,15]
y = [0,1,2,3,4]
X = 1.0
plt.plot(x,y)
plt.xticks(np.arange(min(x), max(x)+1, X))
plt.show()
Clear Constrictor

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code