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()
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()
changing axis labels 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)
xticks and yticks matplotlib
#x-ticks:
plt.xticks(start, stop, step))
#y-ticks:
plt.yticks(np.arange(start,stop,step))
change xticks python
plt.xticks(np.arange(0,10),np.arange(10,20))
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()
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us