0

I am trying to plot a dictionary on a histogram. The problem with the following code is that all bars are plotted with equal heights despite having different values. (see image) Moreover, If I increase this dictionary with 5 times as many entries, the histogram looks like a big rectangle since the bars are not separated from one another. (see image) I have tried to change different parameters into this code but it did not solve these issues.

    import matplotlib.pyplot as plt
    dict_1={'a123456': 3000, 'b123456': 3600, 'c13456': 3700, 'd123456': 4000}
    
    plt.hist(dict_1)
    plt.xticks(size = 10, rotation='vertical')
    plt.margins(0.05)
    plt.subplots_adjust(bottom=0.01)
    plt.show()

enter image description here enter image description here

john johns
  • 167
  • 7

0 Answers0