为什么在下面的Python代码中使用pyplot绘制x轴的范围从0到600 ?它应该在0到2*np.之间吗?



为什么在下面的Python代码中使用pyplot绘制x轴的范围从0到600 ?它应该在0到2*np。之间吗?

import numpy as np
import matplotlib.pyplot as plt
# Create arrays of sine and cosine values
A = np.arange(0, 2 * np.pi, 0.01) # range:0 - 2pi,step length: 0.01
B = np.sin(A)
# Create a figure and axis
fig, ax = plt.subplots(1, 1)
# Plot the sine values on the y-axis
ax.plot(B, color='red', linewidth=3.0, linestyle='--', label="sin(x)")
# Show the plot
plt.show()

寻找解决方案:

ax.plot(A, B, color='red', linewidth=3.0, linestyle='--', label="sin(x)")

最新更新