📌  相关文章
📜  设置轴刻度 matplotlib - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:31.101000             🧑  作者: Mango

代码示例1
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()