Answers for "matplotlib set ticks"

0

Set axis ticks matplotlib

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker

x = [0,5,9,10,15]
y = [0,1,2,3,4]
fig, ax = plt.subplots()
ax.plot(x,y)
start, end = ax.get_xlim()
ax.set_xticks(np.arange(start, end, 2))
plt.show()
Posted by: Guest on August-19-2021
4

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()
Posted by: Guest on December-12-2020
0

change xticks python

plt.xticks(np.arange(0,10),np.arange(10,20))
Posted by: Guest on March-20-2020
-2

matplotlib custom ticks

axis.set_yticks([0.5,0.6,0.7,0.8,0.9,1.0])
Posted by: Guest on April-19-2021

Python Answers by Framework

Browse Popular Code Answers by Language