-1

I have gone through all the steps which are required to get the values on my bar plot. But I am facing some problems here. Please help me out. Sharing the code and Screeenshot.

Code:

ax = sos_df['Status'].value_counts().plot(kind='bar', figsize=(10,7),color="coral", fontsize=13);

I am getting the output as below:

The exact values required for the bar plot I have mentioned are not getting

Please suggest me something which will help me to get the exact values on the plot. Sharing one reference Picture here.:

The numbers which are in yellow color is the output I am looking for (Reference Image from google.com)

1 Answers1

0
ax = sos_df['Status'].value_counts().plot(kind='bar', figsize=(10,7),color="coral", fontsize=13)
for a, b in zip(range(len(set(sos_df['Status']))), list(sos_df['Status'].value_counts())):
    plt.text(a, b, str(b), ha='center')
plt.show()

I imagine this is what you want... but I can only imagine without any sample data.

  • Thank you for the code. Can you please explain the code a bit more so that I will get some idea. – Varun Dahasahasra Mar 19 '18 at 14:26
  • One more thing. In the above code, for sos_df['Status'], there was only one column which had all the values. Now the thing is in another example, I have 1 row and 3 columns having values 115,63, and 52. So I have successfully plotted the bar plot for this. But again I want to see the values on the bars of the plot. So share some ideas that will be helpful for me here. Thank you!! – Varun Dahasahasra Mar 19 '18 at 14:45