本文介绍了inner()为参数'ax'获得了多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 Python 的 Jupyter 笔记本中,我正在从数据框的两列绘制一个 hexbin 联合图.情节已正确绘制,但我无法调整图片大小.

In a Jupyter notebook with Python I am plotting a hexbin jointplot from two columns of a dataframe. The plot is correctly plotted but I cant manage to resize the picture.

代码如下:

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'有多个值

gut I get inner() got multiple values for argument 'ax'

推荐答案

问题在于jointplot 创建自己的图形和轴.因此,它没有可用的 ax 参数.同样,图形的大小总是平方的.要更改大小,请使用 size 参数.

The issue is that jointplot creates its own figure and axes. It therefore does not have an ax argument available. Also the size of the figure is always squared. To change the size, use the size argument.

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

或者,然后更改图形大小,

Or, change the figure size afterwards,

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

这篇关于inner()为参数'ax'获得了多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 13:41