I want to draw two parallel box plot in together. For that I used sub plots function in python, below code I used for the that process, but I couldn't get good out put from the code, because its already draw addition two empty graphs, how I remove these empty graphs from the output? Please give ideas for that?
f, axes = plt.subplots(2,2,figsize = (14,10))
sns.boxplot(x='Heating QC',y='SalePrice',hue='Central Air', data=df ,ax=axes[0,0])
sns.boxplot(x='Heating',y='SalePrice',hue='Central Air', data=df ,ax=axes[0,1])
out put
After changes got below outputs
IndexError Traceback (most recent call last)
<ipython-input-543-7dfa6ebf0390> in <module>
1 f, axes = plt.subplots(1,2,figsize = (14,10))
----> 2 sns.boxplot(x='Heating QC',y='SalePrice',hue='Central Air', data=df ,ax=axes[0,0])
3 sns.boxplot(x='Heating',y='SalePrice',hue='Central Air', data=df ,ax=axes[0,1])
IndexError: too many indices for array
Just create two plots, in which case axes will be a list of 2 elements and use those plot.
Refer the documentation.
f, axes = plt.subplots(2, figsize = (14,10))
sns.boxplot(x='Heating QC',y='SalePrice',hue='Central Air', data=df, ax=axes[0])
sns.boxplot(x='Heating',y='SalePrice',hue='Central Air', data=df, ax=axes[1])