第一个是设置坐标轴的范围,第二个是设置精度及精度的范围:

程序:

import matplotlib.pyplot as plt
import numpy as np

ax = plt.gca()
ax.set_xlim(-10,10)
ax.set_ylim(-10,10)

#网格
plt.grid(linestyle='-.')  #linestyle = ls

my_x1 = np.arange(-5,5,0.5)
plt.xticks(my_x1)

plt.show()

结果:

matplotlib.pyplot.gca().set_xlim(初始值,末值)  与 matplotlib.pyplot.xticks()的区别

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-31
  • 2021-12-05
  • 2021-11-20
  • 2022-12-23
  • 2021-09-03
猜你喜欢
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-04
  • 2022-01-28
相关资源
相似解决方案