On Wed, Sep 2, 2009 at 18:15, Tim Michelsen<timmichel...@gmx-topmail.de> wrote: > Hello fellow numy users, > I posted some questions on histograms recently [1, 2] but still couldn't > find a solution. > > I am trying to create a inverse cumulative histogram [3] which shall > look like [4] but with the higher values at the left.
Okay. That is completely different from what you've asked before. > The classification shall follow this exemplary rule: > > class 1: 0 > all values > 0 > > class 2: 10 > all values > 10 > > class 3: 15 > all values > 15 > > class 4: 20 > all values > 20 > > class 5: 25 > all values > 25 > > [...] > > I could get this easily in a spreadsheet by creating a matix with > conditional statements (if VALUES_COL > CLASS_BOUNDARY; VALUES_COL; '-'). > > With python (numpy or pylab) I was not successful. The plotted histogram > envelope turned out to be just the inverted curve as the one created > with the spreadsheet app. > sums = np.histogram(values, weights=values, > normed=normed, > bins=bins) > ecdf_sums = np.hstack([0.0, sums[0].cumsum() ]) > ecdf_inv_sums = ecdf_sums[::-1] This is not the kind of "inversion" that you are looking for. You want ecdf_inv_sums = ecdf_sums[-1] - ecdf_sums -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion