uses matplotlib to generate histogram