在 python seaborn lmplot 中更改标记大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34796451/
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 15:32:17  来源:igfitidea点击:

changing the marker size in python seaborn lmplot

pythonseaborn

提问by galucero

I am trying to change the size of the lmplot markers in seaborn. I have tried passing 's' or 'size' as arguments and neither of them work.

我正在尝试更改 seaborn 中 lmplot 标记的大小。我试过将 's' 或 'size' 作为参数传递,但它们都不起作用。

lm = sns.lmplot(x="totalX",y="NormI", hue="Data Type", data=df, palette="Set1", legend_out=False, S=20)

I have tried "s", "markersize", "size" I get no effect. I want to make the data points larger on the plot. Any help is much appreciated.

我试过 "s", "markersize", "size" 我没有效果。我想让图上的数据点更大。任何帮助深表感谢。

采纳答案by RDJ

You want to use scatter_kws={"s": 100}

你想用 scatter_kws={"s": 100}

As in:

如:

lm = sns.lmplot(x = "totalX", y = "NormI", hue = "Data Type", data = df, palette="Set1", legend_out=False, scatter_kws={"s": 100})

You can amend the integer value (currently 100) to change the size of the markers.

您可以修改整数值(当前为 100)以更改标记的大小。

I don't know what your hueor palettedata are, but this should work nonetheless.

我不知道你的huepalette数据是什么,但这应该有效。

回答by Michael Hall

I know this question specifies lmplotbut thought I would add an answer for how to do this with a seaborn scatterplot.

我知道这个问题指定了lmplot但我想我会添加一个关于如何用 seaborn 做到这一点的答案scatterplot

df = sns.load_dataset("anscombe")
sp = sns.scatterplot(x="x", y="y", hue="dataset", data=df)

enter image description here

在此处输入图片说明

And to change the size of the points you use the sparameter

并更改您使用s参数的点的大小

sp = sns.scatterplot(x="x", y="y", hue="dataset", data=df, s=100)

enter image description here

在此处输入图片说明