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.
Changing Marker Color on a Scatter Plot Behind the scenes, Seaborn scatter plots use the Matplotlib color styles. Here are the color codes for the basic colors you can use for your scatter plot markers. Pass the value in the argument column to the color parameter to change your marker colors.
Hue can be used to group to multiple data variable and show the dependency of the passed data values are to be plotted. Syntax: seaborn.scatterplot( x, y, data, hue) Python3.
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.
Size in points^2 markersize'] ** 2. This can be taken literally. In order to obtain a marker which is x points large, you need to square that number and give it to the s argument. So the relationship between the markersize of a line plot and the scatter size argument is the square.
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)
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With