【发布时间】:2025-12-01 18:40:02
【问题描述】:
请帮我弄清楚这条线的方程式是什么:
import matplotlib.pyplot as plt
import numpy as np
#start, stop, num (* is args [positional], ** is kwargs[keyword])
x = np.linspace(0, 2*np.pi, 400)
y = np.sin(x ** 2)
#this closes *args
plt.close('all')
#one figure and one subplot
f, ax = plt.subplots()
ax.plot(x,y)
ax.set_title("simple plot")
plt.xlabel('x-axis')
plt.ylabel('y-axis')
plt.show()
代码运行,并返回一个图表,但我无法弄清楚图表的方程式是什么。请帮助我,如果你能解释一下代码做了什么来绘制这个方程。我对python很陌生。 :) 谢谢!
【问题讨论】:
-
怎么不是 x 的平方从 0 到 2*pi 的正弦?
-
y = np.sin(x ** 2)。它在代码中。 -
是不是有人给你代码,不解释类?
标签: python python-3.x plot graphing