rw=RandomWalk(5000)
rw.fill_walk()
plt.scatter(rw.x_values,rw.y_values,s=15)
#color the point as fading
point_numbers=list(range(rw.num_points))
plt.scatter(rw.x_values,rw.y_values,c=point_numbers,cmap=plt.cm.Blues,
edgecolor='none',s=5)
#highlight the start and end point
plt.scatter(0,0,c='yellow',edgecolors='none',s=100)
plt.scatter(rw.x_values[-1],rw.y_values[-1],c='red',edgecolors='none',
s=100)
plt.show()
我正在从书中学习python matplotlib。我输入代码作为书。尽管这些点始终具有结果显示的轮廓,即使我设置edgecolor ='none'时也是如此。这怎么发生的?有人可以告诉我吗?
您要两次提出观点。
一次过大(s=15
)
plt.scatter(rw.x_values,rw.y_values,s=15)
确实具有edgecolor(默认为rcParams["scatter.edgecolors"]
)
然后第二次使用较小的尺寸(s=5
)
plt.scatter(rw.x_values,rw.y_values,c=point_numbers,cmap=plt.cm.Blues,
edgecolor='none',s=5)
净效果是带有边缘的点,并在其上居中带有淡化颜色的较小点
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句