Created
October 1, 2020 07:01
-
-
Save Kamaldeep0077/dde8880e1ab928993b475b183b305566 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Ploting barplot for target | |
plt.figure(figsize=(10,6)) | |
g = sns.barplot(data['stroke'], data['stroke'], palette='Set1', estimator=lambda x: len(x) / len(data) ) | |
#Anotating the graph | |
for p in g.patches: | |
width, height = p.get_width(), p.get_height() | |
x, y = p.get_xy() | |
g.text(x+width/2, | |
y+height, | |
'{:.0%}'.format(height), | |
horizontalalignment='center',fontsize=15) | |
#Setting the labels | |
plt.xlabel('Heart Stroke', fontsize=14) | |
plt.ylabel('Precentage', fontsize=14) | |
plt.title('Percentage of patients will/will not have heart stroke', fontsize=16) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment