# View the heat map of correlations between variables
plt.figure(figsize=(12,7))
correlation_data = df.corr()
correlation_data = round((correlation_data*100),0).astype(int)
sns.heatmap(correlation_data, annot=True, fmt="d", cmap="YlGnBu")
plt.show()
# Setting box plot title, x and y axis labels, range and format
ax = sns.boxplot(data=df, width=0.5, palette="Blues")
ax.set_title('Plot Title')
ax.set_xlabel("Label for x axis");
ax.set_ylabel("Label for y axis");
ax.set_yticklabels(['${:,}m'.format(int(x/1000000)) for x in ax.get_yticks().tolist()]);
ax.grid(which='major', linestyle=':', linewidth='1', color='grey');
for item in ([ax.xaxis.label, ax.yaxis.label]):
item.set_fontsize(14);
item.set_color("blue"); #set the x and y label to blue
# Draw 2 red lines showing the preferred range
ax.axhline(5000000, ls='-', linewidth='1', color='red')
ax.axhline(15000000, ls='-', linewidth='1', color='red')
ax.set_ylim(0, 80000000); #set the upper limit of y axis
Leave a Reply