Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I reduce the data point size in sns.jointplot()?

I have the following code drawing a seaborn jointplot. However I don't seem to figure out how to change the size of the data points. I need them to be smaller. I tried keyword s, which seems to work for other seaborn plots, but here I get the error:

TypeError: regplot() got an unexpected keyword argument 's'

Does anyone know how to adjust it?

g = plt.figure(figsize=(12, 10))

g = (sns.jointplot("age", "months_as_customer",
                   data=matrix_ks.to_pandas(), color="green", s=0.2, kind="reg")
                  .set_axis_labels("Age", "Months as Customer",  fontsize=15))

#g = g.annotate(fontsize=18)
plt.title("Joint Density Estime - Age and Months as Customer", pad= 80, fontsize=15)


plt.show()
like image 940
DataBach Avatar asked Oct 23 '25 03:10

DataBach


1 Answers

Since you defined kind as a regplot, you'll need to pass scatter plot parameters via the parameter scatter_kws. You can look at the regplot documentation to see more details.

df = sns.load_dataset('tips')
sns.jointplot('total_bill', 'tip', df, kind='reg', scatter_kws={'s': 1})

enter image description here

like image 68
busybear Avatar answered Oct 24 '25 16:10

busybear



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!