与Plt. -Scatter()

问题描述 投票:0回答:1

你只是通过
allys
。您还需要为
python jupyter scatter-plot
1个回答
0
投票
值定义第二个数组,并将其传递到

plt.scatter

中,因为它需要
x
y
坐标才能工作。
e.g.
allys = []
allxs = []

for r in np.arange(0.001, 4, 0.001):
    y = np.random.rand()
    for t in range(1000):
        y = r * y * (1 - y)
        if t > 959:
            allys.append(y)
            allxs .append(r) 

plt.scatter(allxs , allys, color='black', s=1)  
    

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.