Skip to main content
 首页 » 编程设计

python之inner() 得到参数 'ax' 的多个值

2025年05月04日21hnrainll

在带有 Python 的 Jupyter notebook 中,我从数据框的两列绘制了一个 hexbin 联合图。情节已正确绘制,但我无法调整图片的大小。

代码如下:

fig, ax = plt.subplots() 
fig.set_size_inches(11.7, 8.27) 
sns.jointplot(x=train['max1'], y=train['intangle'], kind="hex", color="#4CB391",ax=ax) 
plt.show() 

我得到 inner() 得到了参数 'ax' 的多个值

请您参考如下方法:

问题是 jointplot creates its own figure and axes .因此它没有可用的 ax 参数。此外,图形的大小总是平方的。要更改大小,请使用 size 参数。

sns.jointplot(..., size=10) 
plt.show() 

或者,之后改变图形大小,

g = sns.jointplot(...) 
g.fig.set_size_inches(11,6) 
plt.show()