Skip to content

Instantly share code, notes, and snippets.

@mdnurahmed
Last active January 8, 2021 19:39
Show Gist options
  • Save mdnurahmed/83e9ab9bd72be766e4beb4af85aaed19 to your computer and use it in GitHub Desktop.
Save mdnurahmed/83e9ab9bd72be766e4beb4af85aaed19 to your computer and use it in GitHub Desktop.
Generating the bar chart
import numpy as np
dates = []
mins = []
for i in range(0,len(mylist)):
dates.append(mylist[i][0])
mins.append(int(mylist[i][1]/60))
#xcordinates of the bars
xpos = np.arange(len(dates))
#setting labels of xcordinates of the bars
plt.xticks(xpos,dates)
plt.bar(xpos,mins)
#putting values of bars as label on top of the bar
for i in range(0,len(mins)):
plt.text(xpos[i]-0.075 , mins[i] + 3, str(mins[i]), color='red')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment