Python Matplotlib - how to set values on y axis in barchart

Viewed 2961

I am new to Python and I need to generate bar chart using pyplot and matplotlib. So far i tried like this (I have attached only the important code snippet):

    import matplotlib.pyplot as plt
    import numpy as np

    finalDataset=[finalAverage,final4Average]
    N=len(finalDataset) 
    ind=np.arange(N)
    width=0.45
    rects1=plt.bar(ind,finalDataset,width,color='blue')
    plt.xticks(ind+width/2,("A","B"))
    plt.ylabel('y-axis')
    plt.xlabel('x-axis')
    plt.savefig("sample.png")

Output of this code is: output

But my problem is I need output like this (Expected output) : expected output

1 Answers
Related