Annoying weird problem, and I have not yet been able to find a solution on this site (although the question has appeared)
I am trying to make a histogram where the bunkers have a βbar styleβ where vertical lines separate each bit, but no matter what I change the histtype constructor, I get a filled histogram step.
Here is my code. Note. I am using jupyter notebook installed via anaconda with python version 2.7.6.
import numpy as np import matplotlib.pyplot as plt x = np.random.rand((100)) bins = np.linspace(0, 2, 40) plt.title('Relative Amplitude',fontsize=30) plt.xlabel('Random Histogram') plt.ylabel('Frequency',fontsize=30) plt.hist(x, bins, alpha=0.5, histtype='bar') plt.legend(loc='upper right',fontsize=30) plt.xticks(fontsize = 20) plt.yticks(fontsize = 20) plt.show()
This and I get a diagram filled with steps, with no vertical lines separating the columns. What annoys me is that I didnβt have this problem a while ago, something has clearly changed, and I donβt know what. I tried histype = 'barstacked'. Thank you for your help.
source share