Before some yells at me for using bad code for type conversion :), here's a better code:
import numpy sum = numpy.sum(inputs[0].RowData["bin_values"]) array = inputs[0].RowData["bin_values"].astype(numpy.float32) array = 100.0*array/sum output.RowData.append(array, "bin_values") output.RowData.append(inputs[0].RowData["bin_extents"], "bin_extents") On Mon, Jan 12, 2015 at 2:01 PM, Utkarsh Ayachit <utkarsh.ayac...@kitware.com> wrote: > You could do this using a Python Programmable Filter. > > Here's a script to use: > > import numpy > sum = numpy.sum(inputs[0].RowData["bin_values"]) > array = 1.0 * inputs[0].RowData["bin_values"] > array = 100.0*array/sum > output.RowData.append(array, "bin_values") > output.RowData.append(inputs[0].RowData["bin_extents"], "bin_extents") > > Attached is a state file. > > Utkarsh > > On Wed, Jan 7, 2015 at 1:03 PM, Ethan Hereth <e.a.her...@gmail.com> wrote: >> Good afternoon and happy new year! >> >> I have a colleague who would like to be able to plot the relative frequency >> of the histogram data instead of absolute bin count. I.e. instead of having >> the left axis say there are 100 things in bin one, he'd like for it to say >> that 5% of the things are in bin one. >> >> Is this possible? >> >> Thank you! >> >> -- >> Ethan Alan Hereth >> >> _______________________________________________ >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Please keep messages on-topic and check the ParaView Wiki at: >> http://paraview.org/Wiki/ParaView >> >> Search the list archives at: http://markmail.org/search/?q=ParaView >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/paraview >> _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview