I'm trying to construct a simple bar chart using matplotlib
. My code is :
labels = ['A','B','C']
values = [70000,80000,90000]
c = ['#FFC000','#5B9BD5','#404040','#5B9BD5']
barplot = plt.bar(labels,values,width=0.3,color = c)
# setting value in middle
for i in range(len(values)):
plt.annotate(str(values[i]), xy=(labels[i],values[i]), ha='center', va='bottom')
plt.ylabel('Savings')
plt.ylim(50000,100000,5000) # yticks for bar chart
plt.grid(which='major', axis='y', zorder=-1.0) # greenline but hidden behind the bar
plt.show()
Now when I run it on Google Colab
, the axis label lines
are overlaping with my bar chart; Although Jupyter
notebooks do not have this problem.
You can see the problem more clearly with this Colab Link.
Please suggest any solution to fix this out.