Histogram.
hist(y)
bins the elements of y
into 10 equally spaced containers
and returns a histogram bar plot of the results.
If y
is a matrix, hist
works down the columns.
hist(y,m)
, where m
is a scalar, uses m
bins.
hist(y,x)
, where x
is a vector, returns the distribution of y
among bins with centers specified by x
.
p=hist(...)
returns a handle to the plot.
Here is a typical example of using hist:
require "lab" w=gfx.Window(); methods=2; x=lab.randn(1000,methods); w:hist(x,10) w:legend('gauss1','gauss2')
The hist
command, if no color is specified, makes automatic use of
the colors specified by the colorOrder property, e.g:
require "gfx" w=gfx.Window(); x=lab.randn(100,4); p=w:hist(x,10) c=p:get('colorOrder'); for i=1,#c do print(i,c[i][1],c[i][2],c[i][3]); end c[1][1]='0'; c[1][3]=1; p:set('colorOrder',c)The default ColorOrder is listed using the example above where the default is red for one line, and for multiple lines, to cycle through the colors in the table. The last two lines of the example change the first color in the colorOrder to blue.