Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

changing the marker size in python seaborn lmplot

Tags:

python

seaborn

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.

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.

like image 391
galucero Avatar asked Jan 14 '16 17:01

galucero


People also ask

How do you change marker size in Seaborn?

To set the size of markers, we can use the s parameter. This parameter can be used since seaborn is built on the matplotlib module. We can specify this argument in the scatterplot() function and set it to some value. Alternatively, we can control the size of the points based on some variables.

What does the function SNS Lmplot () perform in Seaborn Library?

lmplot() method is used to draw a scatter plot onto a FacetGrid.

What is Lmplot Seaborn?

The lineplot (lmplot) is one of the most basic plots. It shows a line on a 2 dimensional plane. You can plot it with seaborn or matlotlib depending on your preference. The examples below use seaborn to create the plots, but matplotlib to show.

What is the Seaborn Despine () function used for?

The despine() is a function that removes the spines from the right and upper portion of the plot by default. sns. despine(left = True) helps remove the spine from the left.


2 Answers

You want to use 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.

I don't know what your hue or palette data are, but this should work nonetheless.

like image 80
RDJ Avatar answered Oct 22 '22 01:10

RDJ


I know this question specifies lmplot but thought I would add an answer for how to do this with a 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

like image 10
Michael Hall Avatar answered Oct 22 '22 00:10

Michael Hall