Why the point size using sns.lmplot is different when I used plt.scatter?

398 Views Asked by At

I want to do a scatterplot according x and y variables, and the points size depend of a numeric variable and the color of every point depend of a categorical variable.

First, I was trying this with plt.scatter:

Graph 1 enter image description here

After, I tried this using lmplot but the point size is different in relation to the first graph. I think the two graphs should be equals. Why not? The point size is different in every graph.

Graph 2 enter image description here

1

There are 1 best solutions below

0
On

Your question is no so much descriptive but i guess you want to control the size of the marker. Here is more documentation

Here is the start point for you. A numeric variable can also be assigned to size to apply a semantic mapping to the areas of the points:

import seaborn as sns

tips = sns.load_dataset("tips")
sns.scatterplot(data=tips, x="total_bill", y="tip", hue="size", size="size")

enter image description here

For 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 s parameter.

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

enter image description here