67
votes

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

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.

2
How are you plotting and what are you plotting? Without knowing these, it's hard to help - Sheldore
@Bazingaa I added code and a solution I found. Wasn't sure if I should answer my own question or not... - DataMan
That functionality is definitely missed in the doc string. - Soren

2 Answers

118
votes

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

Example:

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

About the update of the legend size, I got it by the attribute 'markerscale' from matplotlib.pyplot.legend

markerscalefloat, default: rcParams["legend.markerscale"] (default: 1.0) The relative size of legend markers compared with the originally drawn ones.

plt.legend(markerscale=2)