[Paraview] Relative frequencies in Histogram plots
Ethan Hereth
e.a.hereth at gmail.com
Fri Jan 16 22:48:22 EST 2015
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.ayachit at 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
> <utkarsh.ayachit at 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.hereth at 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
> >>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20150117/6aa5ed90/attachment.html>
More information about the ParaView
mailing list