Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

inner() got multiple values for argument 'ax'

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.

Here is the code:

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

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

like image 335
Andrea Sindico Avatar asked Oct 27 '25 09:10

Andrea Sindico


1 Answers

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()
like image 53
ImportanceOfBeingErnest Avatar answered Oct 28 '25 22:10

ImportanceOfBeingErnest



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!