Matplotlib: How to make a histogram with bins of equal area?
问题 Given some list of numbers following some arbitrary distribution, how can I define bin positions for matplotlib.pyplot.hist() so that the area in each bin is equal to (or close to) some constant area, A? The area should be calculated by multiplying the number of items in the bin by the width of the bin and its value should be no greater than A. Here is a MWE to display a histogram with normally distributed sample data: import matplotlib.pyplot as plt import numpy as np x = np.random.randn(100