Re: [Paraview] Relative frequencies in Histogram plots
Utkarsh, Thank you very much. That is exactly what we were looking for. I just knew that there had to be a way to do it using the "Programmable Filter" but I didn't know how! Cheers, and thank you again for your help. On Mon Jan 12 2015 at 5:07:53 PM Utkarsh Ayachit < utkarsh.ayac...@kitware.com> wrote: > 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 > 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 > 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
Re: [Paraview] Relative frequencies in Histogram plots
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 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 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
Re: [Paraview] Relative frequencies in Histogram plots
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 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 > Example.pvsm Description: Binary data ___ 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
[Paraview] Relative frequencies in Histogram plots
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