I have created a plot using matplotlib and seaborn in python. The code is given below:
fig = plt.figure(figsize=(15, 8), facecolor='#e4e5e9', dpi=100,)
spec = fig.add_gridspec(ncols=6, nrows=2)
ax0 = fig.add_subplot(spec[0, :4])
sns.countplot(x='Min. Exp.',data=df, color='#657ffb', **{'edgecolor':'black'})
plt.ylabel("Job Count", fontsize=11)
plt.xlabel('Minimum Experience', fontsize=11)
plt.xlim(0,20)
plt.ylim(0,2400)
ax1 = fig.add_subplot(spec[1, :4])
sns.countplot(x='Max. Exp.',data=df, color='#bad2ef', **{'edgecolor':'black'})
plt.ylabel("Job Count", fontsize=11)
plt.xlabel('Maximum Experience', fontsize=11)
plt.ylim(0,2400)
# plt.xlim(0,20)
ax2 = fig.add_subplot(spec[:, 4])
sns.boxplot(y=df['Min. Exp.'], color='#657ffb')
plt.xlabel('Minimum Experience',labelpad=5, **{'fontsize':10})
plt.ylim(0,31)
plt.ylabel('')
ax3 = fig.add_subplot(spec[:, 5])
sns.boxplot(y=df['Max. Exp.'], color='#bad2ef')
plt.xlabel('Maximum Experience',labelpad=5, **{'fontsize':10})
plt.ylabel('')
plt.ylim(0,31)
for ax in [ax0,ax1,ax2,ax3]:
ax.patch.set_alpha(0.0)
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
fig.suptitle('Job Experience Demanded in Data Scientist Roles in India', fontsize=17, y=1)
plt.savefig('job_exp2.jpg')
plt.show()
And the output is: job_exp2.jpg
But the title is too close to the top edge. (The y parameter in fig.suptitle() can only adjust space below the title). How can I adjust the title position slightly downwards or add some space above the title (so that it is not too close to the edge)?