enter image description hereSo I have this code which generates a plot:
g=sns.catplot(data=public, x="age", y="number", col="species", kind="strip",
jitter=True, order=order,
palette=palette, alpha=0.5,linewidth=3,height=6, aspect=0.7)
How to I change markers size?
size=20
acts weird and seems to zoom the plot area instead of changing markers size. And i get:
'.conda-envs/py3/lib/python3.5/site-packages/seaborn/categorical.py:3692: UserWarning: The size
paramter has been renamed to height
; please update your code.
warnings.warn(msg, UserWarning'
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.
cifloat or “sd” or None, optional. Size of confidence intervals to draw around estimated values. If “sd”, skip bootstrapping and draw the standard deviation of the observations.
Strip plot It is used to draw a scatter plot based on the category. Syntax: seaborn.stripplot(*, x=None, y=None, hue=None, data=None, order=None, hue_order=None, jitter=True, dodge=False, orient=None, color=None, palette=None, size=5, edgecolor='gray', linewidth=0, ax=None, **kwargs)
Use s instead of size. the default s is 5.
Example:
sns.catplot(x = "time",
y = "total_bill",
s = 20,
data = tips)
sns.catplot(x = "time",
y = "total_bill",
s = 1,
data = tips)
There is a conflict between the parameter 'size' in sns.stripplot
and the deprecated 'size' of sns.catplot
, so when you pass 'size' to the latter, it overrides the 'height' parameter and shows the warning message you saw.
Workaround
From looking inside the source code, I've found that 's' is an alias of 'size' in sns.stripplot
, so the following works as you expected:
g=sns.catplot(data=public, x="age", y="number", col="species", kind="strip",
jitter=True, order=order, s=20,
palette=palette, alpha=0.5, linewidth=3, height=6, aspect=0.7)
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