x = [np.sqrt(.16425), 0.54455260535599315,
0.70689815390903377,
0.90923319341079933,
0.82807306440917394,
1.1290283433111854]
x
y = [0.8187249999999999,
1.0933652892561987,
1.419317391304348,
1.8247052631578946,
1.6618111111111107,
2.2666052631578943]
def graph(formula, x_range):
x =np.array(x_range)
y =eval(formula)
plt.plot(x, y)
graph('0.00030796 + 2.00697*x', range(np.divide(1,2),2))
plt.scatter(x,y)
plt.xlabel('Sqaure Root of Length (m^(1/2))')
plt.ylabel('Approximate Average Period (s)')
plt.show()
我所要做的就是绘制一些数据点和一条理论线,但我的范围只接受整数值,所以我不知道如何制作一个漂亮的图形来显示我的数据点和通过它们的理论路线。有人可以帮助我吗?