如何在Python中更改轴间距?

如何在Python中更改轴间距?,python,matplotlib,Python,Matplotlib,我已经为发动机的活塞速度绘制了以下曲线图。请注意,x轴上的角度约为0到360度,间距为50。我如何将其更改为间隔90?谢谢任何人能提供的帮助 我的绘图代码如下所示: plt.figure() x_axis = theta_range_deg plt.subplot(1, 3, 1) plt.plot(x_axis, position_list) plt.xlabel("Angle (degrees)") plt.ylabel("Position (in)"

我已经为发动机的活塞速度绘制了以下曲线图。请注意,x轴上的角度约为0到360度,间距为50。我如何将其更改为间隔90?谢谢任何人能提供的帮助

我的绘图代码如下所示:

plt.figure()
x_axis = theta_range_deg
plt.subplot(1, 3, 1)
plt.plot(x_axis, position_list)
plt.xlabel("Angle (degrees)")
plt.ylabel("Position (in)")
plt.title("Position vs Angle")
plt.grid(color='grey', linestyle='-', linewidth=.5)

plt.subplot(1, 3, 2)
plt.plot(x_axis, piston_speed_list)
plt.plot(x_axis,mean_speed_list)
plt.plot(90, 0,'.', color = 'black')
plt.plot(270, 0,'*', color = 'black')
plt.xlabel("Angle (degrees)")
plt.ylabel("Piston Velocity (mph)")
plt.title("Piston Speed vs Angle")
plt.grid(color='grey', linestyle='-', linewidth=.5)
plt.gca().legend(('True Speed','Mean Piston Speed','Top Dead Center','Bottom Dead Center'))

plt.subplot(1, 3, 3)
plt.plot(x_axis, acceleration_list)
plt.xlabel("Angle (degrees)")
plt.ylabel("Piston Acceleration (g)")
plt.title("Piston Net Force vs Angle")
plt.grid(color='grey', linestyle='-', linewidth=.5)
plt.show()
您可以利用,在半闭合间隔[开始,结束]和步长上传递勾号位置列表,例如:

import matplotlib.pyplot as plt

import numpy as np

plt.xticks(np.arange(0, 450, step=90))
plt.show()

您使用的绘图库是什么?您需要添加标记,例如。它还可能有助于提供一个。顺便说一句,欢迎使用堆栈溢出!查看,如果您需要提示。这正是我想要的。非常感谢much@youguysfail不客气。如果我的回答有帮助,别忘了点击复选标记(✓) 在答案旁边,将其从灰色切换为填充。谢谢。