Keith Sloan <ke...@sloan-home.co.uk> writes: > Thanks > > Not sure where I get centers & edges from
Every time you call np.histogram the second return will be an array of edges; so you define centers anywhere after your first np.histogram call, e.g. with your bins1 variable. (I can't tell if this is exactly the case, but it looks like you are pre-defining your bin edges in the `bins` variable, which would allow you to use that as well.) > > ##### Plot of Histogram of Stacked Counts of Red elliptical Galaxies versus > Red Shift > REMrange1 = > RedEllipticalMasses[RedEllipticalMasses[RedEllipticalMasses['uminusr']>1.8]['uminusr'] > <2.0] > print(len(REMrange1)) > counts1, bins1 = np.histogram(REMrange1['Z_1'],bins=bins) After this line if bins is an array of bin edges it just gets copied to bins1. (the edges return is useful when bins are defined with an integer (total number) and range is a tuple (xmin, xmin)). So you can define centers with: centers = 0.5 * (bins1[1:] + bins1[:-1] _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion