对x和y调用带有数组的plot函数做什么?看第15行。你知道吗
x1 = stats.norm.ppf(0.001)
x2 = stats.norm.ppf(0.999)
x = np.linspace(x1, x2, 100)
y = stats.norm.pdf(x)
yhalf = []
for i in range(len(x)):
if i > len(x)/2:
yhalf.append(y[i])
else:
yhalf.append(0)
plt.plot([x, x], [y, yhalf], 'y-')
plt.axes().set_xlim(x1, x2)
它是否填满了两条曲线之间的区域?我们能控制这种填充物吗?我想用透明的平滑颜色填充。你知道吗
谢谢!你知道吗
从the docs:
也就是说,如果我们有大小相同的
a, b, c, d
所有np.array
,命令plt.plot([a, b], [c, d])
将绘制s
行数(a[0], c[0]) -> (b[0], d[0])
。你知道吗在您的例子中,
yhalf[0:len(x)/2]
是0,其他值与y
相同。根据我之前所说的,你从(x[i], y[i]) -> (x[i], yhalf[i])
中画线,这是如果要填充两条曲线之间的区域,请尝试^{} 。如果我没记错的话,你应该可以把它当作
相关问题 更多 >
编程相关推荐