Python 所有标记的seaborn散点图标记大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52785101/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 20:11:03  来源:igfitidea点击:

seaborn scatterplot marker size for ALL markers

pythonmatplotlibseaborn

提问by DataMan

I can't find out anywhere how to change the marker size on seaborn scatterplots. There is a sizeoption listed in the documentationbut it is only for when you want variable size across points. I want the same size for all points but larger than the default!

我无法在任何地方找到如何更改 seaborn 散点图上的标记大小。文档中size列出了一个选项,但仅适用于您想要跨点可变大小的情况。我想要所有点的大小相同但比默认值大!

I tried making a new column of integers in my dataframe and set that as the size, but it looks like the actual value doesn't matter, it changes the marker size on a relative basis, so in this case all the markers were still the same size as the default.

我尝试在我的数据框中创建一个新的整数列并将其设置为大小,但看起来实际值并不重要,它会在相对基础上更改标记大小,因此在这种情况下,所有标记仍然是与默认大小相同。

Edit: here's some code

编辑:这是一些代码

ax = sns.scatterplot(x="Data Set Description", y="R Squared", data=mean_df)
plt.show()

I just tried something and it worked, not sure if it's the best method though. I added size=[1, 1, 1, 1, 1, 1] and sizes=(500, 500). So essentially I'm setting all sizes to be the same, and the range of sizes to be only at 500.

我只是尝试了一些东西并且它起作用了,但不确定这是否是最好的方法。我添加了 size=[1, 1, 1, 1, 1, 1] 和 size=(500, 500)。所以基本上我将所有尺寸设置为相同,并且尺寸范围仅为 500。

回答by Xiaoyu Lu

You can do so by giving a value to the sargument to change the marker size.

您可以通过为s参数指定一个值来更改标记大小。

Example:

例子:

ax = sns.scatterplot(x="Data Set Description", y="R Squared", data=mean_df, s=10)