Skip to content

Instantly share code, notes, and snippets.

@abhishek-shrm
Created May 4, 2020 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhishek-shrm/71ce47be0701ecbcb1b81b2905bbbac5 to your computer and use it in GitHub Desktop.
Save abhishek-shrm/71ce47be0701ecbcb1b81b2905bbbac5 to your computer and use it in GitHub Desktop.
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