2d histograms?
etienne at isr.ist.utl.pt
etienne at isr.ist.utl.pt
Sat Jan 10 16:10:09 CST 2009
Quoting Søren Hauberg <soren at hauberg.org> (Fri, 09 Jan 2009 15:25:12 +0100):
> Hi All,
> Does anybody have code to create 2 dimensional histograms that they
> are willing to share? I've found some code online, but it requires the
> 'histc' function which we don't have in Octave (yet).
>
> Søren
Isn't it already in octave-forge (pkg plot, I think)?
Hth,
Etienne
octave:5> xy = randn (100,2)*[10 0;0 1]*[1 -1;1 1];
octave:6> [hh,xi,yi] = hist2d (xy)
hh =
0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 5 0 0
0 0 0 0 0 0 12 0 0 0
0 0 0 0 1 5 2 0 0 0
0 0 0 2 18 4 0 0 0 0
0 0 4 20 4 0 0 0 0 0
0 2 5 1 0 0 0 0 0 0
0 7 1 0 0 0 0 0 0 0
5 0 0 0 0 0 0 0 0 0
xi =
-22.3077 -17.0190 -11.7303 -6.4415 -1.1528 4.1359
9.4246 14.7134 20.0021 25.2908
yi =
-26.43426 -20.98045 -15.52664 -10.07283 -4.61902 0.83479
6.28860 11.74241 17.19622 22.65003
octave:7> which hist2d
hist2d is the user-defined function from the file
/home/etienne/prog/octave/svn-octave-forge/octave-forge/main/plot/inst/hist2d.m
octave:8> version
ans = 3.0.3
### Note that my octave-forge is a little non-standard
--
http://www.isr.ist.utl.pt/~etienne
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
More information about the Help-octave
mailing list