openbrainsrc / Radian

Plotting with AngularJS
http://openbrainsrc.github.io/Radian/index.html
168 stars 19 forks source link

histogram with scrubbable number of bins #3

Closed glutamate closed 11 years ago

glutamate commented 11 years ago

if histogram took a 1-d array of values (say, samples from the posteriror for a single parameter) it could have a scrubbable number of bins. (and even, later, a switch to kernel density estimation with scrubbable bandwidth)

e.g. avoid this situation

http://www.mydogear.com/articles/5167a320f1a81d0221600366

ian-ross commented 11 years ago

Yes, number of bins should be switchable (I like the idea of making it scrubbable). I'd also like to have optional rug plots at the bottom of histograms (e.g. http://www.mathworks.com/matlabcentral/fx_files/27582/4/rug.jpeg) -- it gives visually appealing feedback about that sort of problem shown in the page you linked.

On 12 April 2013 17:15, Tom Nielsen notifications@github.com wrote:

if histogram took a 1-d array of values (say, samples from the posteriror for a single parameter) it could have a scrubbable number of bins. (and even, later, a switch to kernel density estimation with scrubbable bandwidth)

e.g. avoid this situation

http://www.mydogear.com/articles/5167a320f1a81d0221600366

— Reply to this email directly or view it on GitHubhttps://github.com/glutamate/Radian/issues/3 .

Ian Ross Tel: +43(0)6804451378 ian@skybluetrades.net www.skybluetrades.net

glutamate commented 11 years ago

yes, that's nice.

ian-ross commented 11 years ago

I did a quick thing for this: I just added a "histogram" function to the Radian plotting library to do binning (and fixed a couple of bugs to do with plot updating: it's good to play with these things...). Example 32 in the Radian repo (called "Histogram") shows the sort of thing you can do. I've just made the number of bins a for demonstration purposes, but it would be easy to use a scrubbable instead.

No rugs yet, but they'll be easy.

On 12 April 2013 17:37, Tom Nielsen notifications@github.com wrote:

yes, that's nice.

— Reply to this email directly or view it on GitHub< https://github.com/glutamate/Radian/issues/3#issuecomment-16299926> .

Ian Ross Tel: +43(0)6804451378 ian@skybluetrades.net www.skybluetrades.net

— Reply to this email directly or view it on GitHubhttps://github.com/glutamate/Radian/issues/3#issuecomment-16333927 .

ian-ross commented 11 years ago

Bear in mind that this is just a proof of concept. I'm going to change the current "nbins" argument of the histogram function to take an object that will allow you to specify bin widths directly, or to say that you want "nice" bins. The current implementation just splits the data range evenly without any regard for rounding bin boundaries to give nice values. The return value from histogram is an object with bin centres, counts and frequencies. I can't think of anything to add to that, unless you want to allow irregularly sized bins (some people seem to like those, but I think that they're just confusing, since you need to look at bar areas rather than just height -- great if you have something to hide, not so great if you're aiming for clarity...). Anyway, it's kind of pleasing how easy this was to do (apart from the gnarly bugs in the guts of the Radian plot setup code that it turned up!).

On 13 April 2013 16:39, Tom Nielsen notifications@github.com wrote:

Jolly good. Will try it out tonight. On 13 Apr 2013 15:22, "Ian Ross" notifications@github.com wrote:

I did a quick thing for this: I just added a "histogram" function to the Radian plotting library to do binning (and fixed a couple of bugs to do with plot updating: it's good to play with these things...). Example 32 in the Radian repo (called "Histogram") shows the sort of thing you can do. I've just made the number of bins a