[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ePiX-users] Histograms
From: |
Marcus D. Hanwell |
Subject: |
Re: [ePiX-users] Histograms |
Date: |
Wed, 3 Jan 2007 11:45:10 +0000 |
User-agent: |
KMail/1.9.5 |
On Wednesday 03 January 2007 02:46, Andrew D. Hwang wrote:
> My current line of thought has a "data_bin" class, which is created from
> a minimum and maximum value, an optional number of bins (1 by default),
> and perhaps a function that specifies bin widths in some convenient way.
> For example,
>
> data_bin(0, 10); // the interval [0,10]
> data_bin(0, 10, 5); // [0,2], [2,4], ..., [8,10]
> data_bin(1, 8, 3, geom); // [1,2], [2,4], [4,8]; geom(x) = pow(2, x)
>
> Interval divisions can be added manually, e.g.
>
> data_bin B(0, 10);
> B.cut(3).cut(7); // B = [0,3], [3,7], [7,10]
> B.cut(20); // out of range, no effect
This sounds good. In my experience most histograms have equal sized bins as
that most easily communicates the data. Also in my field people rarely scale
the data and it is in fact preferred for most of my plots to have the raw
numbers.
>
> Data can be read in from a vector of doubles or from a file. Once data has
> been read in, no further interval subdivision is permitted.
>
> B.read("myfile.dat", 2); // read in column 2
> B.cut(5.5); // no effect
>
> Draw a histogram with specified vertical scale or area:
>
> B.histogram(); // defaults to "area = number of data points"
> B.histogram(3); // triple box heights or total area 3...?
> B.histogram(1/B.pop()); // unit-area histogram; B.pop() = population
> B.normalize(); // now histograms will have unit area by default
>
> Are there other features that would be useful? Does the syntax above seem
> natural and easy to use? Are there common or standard ways of dividing an
> interval into bins other than "equal length", and if so, what would be a
> convenient mathematical description? Would it be useful to apply a user-
> specified function to data as it's read in?
In my opinion this looks like a nice way to plot histograms that could be
extended in future. One thing we sometimes want to do is plot the histogram
feintly and then plot a trend line of the histogram points with cubic splines
or something to smooth. I have seen this done in several places and it looks
quite effective.
On an unrelated note is it currently possible to plot graphs on a log scale at
all? Or would I be best just modifying the data for now and plotting log(y)?
I would miss the tick marks as they get closer on the log plots but could
live with it for now.
>
> Thanks in advance for your input.
I hope it is useful and I would be interested to hear what others think. I
think with a few small additions ePiX would be very useful for data plotting.
It is great being able to easily plot data along with arbitrary functions on
the same graph too.
I would welcome a legend function to draw a box on my graph around an
annotated legend but I think I have figured out how to do that quite
effectively using a small function anyway.
I would love to be able to composite multiple graphs using this environment
but it sounds like that is in the works for ePiX 2 - we often inlay a small
graph in the top corner of the main graph in papers. There is also the use of
two different x and y scales to compare data with different scales side by
side but again I think that would be better implemented in ePiX 2.
Thanks,
Marcus