text_plain_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

df = pd.read_csv('/kaggle/input/heart-disease-dataset/heart.csv')

df.dtypes

feature_list = [feature for feature in df.columns]

fig, ax = plt.subplots(figsize=(10,8))
sns.heatmap(df.corr(),annot=True,ax=ax,cmap="Greys")

fig = plt.figure(figsize=(18, 15))
gs = fig.add_gridspec(3, 3)
gs.update(wspace=0.5, hspace=0.25)
ax0 = fig.add_subplot(gs[0, 0])
ax1 = fig.add_subplot(gs[0, 1])
ax2 = fig.add_subplot(gs[0, 2])
ax3 = fig.add_subplot(gs[1, 0])
ax4 = fig.add_subplot(gs[1, 1])
ax5 = fig.add_subplot(gs[1, 2])
ax6 = fig.add_subplot(gs[2, 0])
ax7 = fig.add_subplot(gs[2, 1])
ax8 = fig.add_subplot(gs[2, 2])
background_color = '#ffffff'
color_palette = ['#397367', '#63CCCA', '#5DA399', '#42858C', '#35393C']
fig.patch.set_facecolor(background_color)
ax0.set_facecolor(background_color)
ax1.set_facecolor(background_color)
ax2.set_facecolor(background_color)
ax3.set_facecolor(background_color)
ax4.set_facecolor(background_color)
ax5.set_facecolor(background_color)
ax6.set_facecolor(background_color)
ax7.set_facecolor(background_color)
ax8.set_facecolor(background_color)
ax0.spines['bottom'].set_visible(False)
ax0.spines['left'].set_visible(False)
ax0.spines['top'].set_visible(False)
ax0.spines['right'].set_visible(False)
ax0.tick_params(left=False, bottom=False)
ax0.set_xticklabels([])
ax0.set_yticklabels([])
ax0.text(0.5, 0.5, 'Count plot for various\n categorical features\n_________________', horizontalalignment='center', verticalalignment='center', fontsize=18, fontweight='bold', fontfamily='serif', color='#000000')
ax1.text(0.3, 750, 'Sex', fontsize=14, fontweight='bold', fontfamily='serif', color='#000000')
ax1.grid(color='#000000', linestyle=':', axis='y', zorder=0, dashes=(1, 5))
sns.countplot(ax=ax1, data=df, x='sex', palette=color_palette)
ax1.set_xlabel('')
ax1.set_ylabel('')
ax2.text(0.3, 730, 'Exang', fontsize=14, fontweight='bold', fontfamily='serif', color='#000000')
ax2.grid(color='#000000', linestyle=':', axis='y', zorder=0, dashes=(1, 5))
sns.countplot(ax=ax2, data=df, x='exang', palette=color_palette)
ax2.set_xlabel('')
ax2.set_ylabel('')
ax3.text(1.5, 630, 'Ca', fontsize=14, fontweight='bold', fontfamily='serif', color='#000000')
ax3.grid(color='#000000', linestyle=':', axis='y', zorder=0, dashes=(1, 5))
sns.countplot(ax=ax3, data=df, x='ca', palette=color_palette)
ax3.set_xlabel('')
ax3.set_ylabel('')
ax4.text(1.5, 530, 'Cp', fontsize=14, fontweight='bold', fontfamily='serif', color='#000000')
ax4.grid(color='#000000', linestyle=':', axis='y', zorder=0, dashes=(1, 5))
sns.countplot(ax=ax4, data=df, x='cp', palette=color_palette)
ax4.set_xlabel('')
ax4.set_ylabel('')
ax5.text(0.5, 900, 'Fbs', fontsize=14, fontweight='bold', fontfamily='serif', color='#000000')
ax5.grid(color='#000000', linestyle=':', axis='y', zorder=0, dashes=(1, 5))
sns.countplot(ax=ax5, data=df, x='fbs', palette=color_palette)
ax5.set_xlabel('')
ax5.set_ylabel('')
ax6.text(0.75, 550, 'Restecg', fontsize=14, fontweight='bold', fontfamily='serif', color='#000000')
ax6.grid(color='#000000', linestyle=':', axis='y', zorder=0, dashes=(1, 5))
sns.countplot(ax=ax6, data=df, x='restecg', palette=color_palette)
ax6.set_xlabel('')
ax6.set_ylabel('')
ax7.text(0.85, 520, 'Slope', fontsize=14, fontweight='bold', fontfamily='serif', color='#000000')
ax7.grid(color='#000000', linestyle=':', axis='y', zorder=0, dashes=(1, 5))
sns.countplot(ax=ax7, data=df, x='slope', palette=color_palette)
ax7.set_xlabel('')
ax7.set_ylabel('')
ax8.text(1.2, 570, 'Thal', fontsize=14, fontweight='bold', fontfamily='serif', color='#000000')
ax8.grid(color='#000000', linestyle=':', axis='y', zorder=0, dashes=(1, 5))
sns.countplot(ax=ax8, data=df, x='thal', palette=color_palette)
ax8.set_xlabel('')
ax8.set_ylabel('')
for s in ['top', 'right', 'left']:
    ax1.spines[s].set_visible(False)
    ax2.spines[s].set_visible(False)
    ax3.spines[s].set_visible(False)
    ax4.spines[s].set_visible(False)
    ax5.spines[s].set_visible(False)
    ax6.spines[s].set_visible(False)
    ax7.spines[s].set_visible(False)
    ax8.spines[s].set_visible(False)