gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 10:15:25 24 4
gpt4 key购买 nike

我有以下代码绘制了一个seaborn联合图。但是我似乎不知道如何改变数据点的大小。我需要它们更小。我试过关键字 s ,这似乎适用于其他 seaborn 情节,但在这里我得到错误:

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

最佳答案

由于您定义了 kind作为 regplot,您需要通过参数 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

关于python - 如何减少 sns.jointplot() 中的数据点大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61084145/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com