如何减少sns.jointplot()中的数据点大小?

时间:2020-04-07 15:53:52

标签: python matplotlib plot seaborn

我有以下代码绘制海洋联合图。但是我似乎不知道如何更改数据点的大小。我需要它们较小。我尝试了关键字s,该关键字似乎适用于其他海图,但是在这里出现了错误:

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

有人知道如何调整吗?

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()

1 个答案:

答案 0 :(得分:1)

由于您将kind定义为规则图,因此需要通过参数scatter_kws传递散点图参数。您可以查看regplot documentation来了解更多详细信息。

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

enter image description here