Skip to content

Instantly share code, notes, and snippets.

@ocaoimh
Created April 1, 2023 14:51
Show Gist options
  • Save ocaoimh/75bc7bac4ef972b46023629be1e90ad3 to your computer and use it in GitHub Desktop.
Save ocaoimh/75bc7bac4ef972b46023629be1e90ad3 to your computer and use it in GitHub Desktop.
fig, axes = plt.subplots(5, 3, sharex=True, figsize=(18,40)) # 5 rows x 3 columns
fig.subplots_adjust(hspace=0.1, wspace=.5) # ensure that the plots do not overlap
fig.suptitle('Insurance claims')
sns.boxplot(ax=axes[0, 0], data=data, x="total_claim_amount", y="state")
sns.boxplot(ax=axes[0, 1], data=data, x="total_claim_amount", y="response")
sns.boxplot(ax=axes[0, 2], data=data, x="total_claim_amount", y="coverage")
sns.boxplot(ax=axes[1, 0], data=data, x="total_claim_amount", y="education")
sns.boxplot(ax=axes[1, 1], data=data, x="total_claim_amount", y="employmentstatus")
sns.boxplot(ax=axes[1, 2], data=data, x="total_claim_amount", y="gender")
sns.boxplot(ax=axes[2, 0], data=data, x="total_claim_amount", y="location_code")
sns.boxplot(ax=axes[2, 1], data=data, x="total_claim_amount", y="marital_status")
sns.boxplot(ax=axes[2, 2], data=data, x="total_claim_amount", y="policy_type")
sns.boxplot(ax=axes[3, 0], data=data, x="total_claim_amount", y="policy")
sns.boxplot(ax=axes[3, 1], data=data, x="total_claim_amount", y="renew_offer_type")
sns.boxplot(ax=axes[3, 2], data=data, x="total_claim_amount", y="renew_offer_type")
sns.boxplot(ax=axes[4, 0], data=data, x="total_claim_amount", y="sales_channel")
sns.boxplot(ax=axes[4, 1], data=data, x="total_claim_amount", y="vehicle_class")
sns.boxplot(ax=axes[4, 2], data=data, x="total_claim_amount", y="vehicle_size")
#Source: https://dev.to/thalesbruno/subplotting-with-matplotlib-and-seaborn-5ei8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment