I am attempting to draw a histogram in Python using the marplot.lib library; however, I keep getting this error: "AttributeError: bins must increase monotonically."
This is my code at the moment:
def draw_viz(info):
stars = [tup[0] for tup in info]
scores = [tup[1] for tup in info]
plt.hist(range, scores)
plt.show()
The parameter being passed in is info. Info is a list of tuples that could look like this:
[(4, 0.7984031936127745), (5, 0.5988023952095809), (5, 0.8739076154806492), (5, 0.7364544976328248), (3, 0.9980039920159681), (1, 0.8455034588777863), (4, 0.6659267480577137), (5, 0.9950248756218907), (5, 0.9991673605328892), (3, 0.5828476269775188), (1, 0.5226084980686208), (1, 0.5291005291005291), (4, 0.7984031936127745), (4, 0.5380476556495004), (5, 0.6357856494096277), (2, 0.9975062344139651), (4, 0.6644518272425249)]
My range is restricted to 1,2,3,4,or 5. The scores are between 0 and 1.
I'd like to draw a histogram that can handle what I am passing in, but I'm really unsure of how to do so or even initialize bins for this one...
Any help would be appreciated!