0

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

  • Does this answer your question? [seaborn scatterplot marker size for ALL markers](https://stackoverflow.com/questions/52785101/seaborn-scatterplot-marker-size-for-all-markers) – nidabdella Jan 27 '21 at 18:22
  • 1
    Please do not provide data/code/error messages as images. Post the text directly here on SO. – Mr. T Jan 27 '21 at 22:54

1 Answers1

0

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

Jay Patel
  • 1,374
  • 1
  • 8
  • 17