Created
May 4, 2020 05:19
-
-
Save abhishek-shrm/71ce47be0701ecbcb1b81b2905bbbac5 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
fig=plt.figure(figsize=(6,6)) | |
temp=[ random.uniform(20,40) for i in range(5)] | |
city=['City A','City B','City C','City D','City E'] | |
y_pos=list(range(1,6)) | |
graph=plt.bar(y_pos, temp,color='violet') | |
plt.xticks(y_pos,city) | |
plt.title('City Temperature') | |
plt.xlabel('Cities') | |
plt.ylabel('Temperature ($^\circ$C)') | |
for bar,t in zip(graph,temp): | |
plt.text(bar.get_x() + bar.get_width()/2.0,bar.get_height(),'%.2f $^\circ$C'%t,ha='center',va='bottom') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment