seaborn scatterplot marker size for ALL markers

Question:

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.

Asked By: DataMan

||

Answers:

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)
Answered By: Xiaoyu Lu

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)
Answered By: Rian.Lopes
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.