繁体   English   中英

将散点图中的标记大小调整为实际尺寸

[英]adjusting marker size to real dimensions in scatter plot

我有两个numpy数组x和y。 现在,我想保存一个散点图。 默认情况下,可以使用散点图中的“ s”参数更改标记的大小。

x = np.array([1,2,3,4])
y = np.array([2,3,4,5])
plt.scatter(x,y, s=0.1)

但是s选项以点为单位,而不是以x和y轴为单位。 有没有办法做到这一点?

关于将point ^ 2用于散点图的问题,还有其他stackoverflow.com答案。 值得检查那些。

x = np.array([1,2,3,4])
y = np.array([2,3,4,5])
plt.figure(figsize=(5, 5), dpi=80)
''' 
i.e. 400x400 'dots' point^2 is proportional to area so 25% width of the 
width in 'dots' would be 100x100 giving s=10000.

You can work out the size of the markers in term of the range of values
in x and y, allowing for margins and the scale.
'''
plt.scatter(x,y, s=10000)
plt.show()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM