- Scilab Help
- Graphics
- 2d_plot
- LineSpec
- Matplot
- Matplot1
- Matplot properties
- Sfgrayplot
- Sgrayplot
- champ
- champ1
- champ properties
- comet
- contour2d
- contour2di
- contourf
- errbar
- fchamp
- fcontour2d
- fec
- fec properties
- fgrayplot
- fplot2d
- grayplot
- grayplot properties
- graypolarplot
- histplot
- paramfplot2d
- plot
- plot2d
- plot2d1
- plot2d2
- plot2d3
- plot2d4
- polarplot
Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
histplot
plot a histogram
Calling Sequence
[cf, ind] = histplot(n, data [,normalization] [,polygon], <opt_args>) [cf, ind] = histplot(x, data [,normalization] [,polygon], <opt_args>)
Arguments
- n
positive integer (number of classes)
- x
increasing vector defining the classes (
x
may have at least 2 components)- data
vector (data to be analysed)
- normalization
a boolean (%t (default value) or %f)
- polygon
a boolean (%t or %f (default value))
- <opt_args>
This represents a sequence of statements
key1=value1,key2=value2
,... wherekey1
,key2,...
can be any optional plot2d parameter (style,strf,leg, rect,nax, logflag,frameflag, axesflag
).- cf
This represents a sequence of statements
key1=value1,key2=value2
,... wherekey1
,key2,...
can be any optional plot2d parameter (style,strf,leg, rect,nax, logflag,frameflag, axesflag
).- ind
This represents a sequence of statements
key1=value1,key2=value2
,... wherekey1
,key2,...
can be any optional plot2d parameter (style,strf,leg, rect,nax, logflag,frameflag, axesflag
).
Description
This function plots a histogram of the data
vector using the
classes x
. When the number n
of classes is provided
instead of x
, the classes are chosen equally spaced and
x(1) = min(data) < x(2) = x(1) + dx < ... < x(n+1) = max(data)
with dx = (x(n+1)-x(1))/n.
The classes are defined by C1 = [x(1), x(2)] and Ci = ( x(i), x(i+1)] for i >= 2.
Noting Nmax the total number of data
(Nmax = length(data)) and Ni the number
of data
components falling in Ci, the value of the histogram for x in Ci
is equal to Ni/(Nmax (x(i+1)-x(i))) when normalization
is true
(default case) and else, simply equal to Ni. When normalization occurs the
histogram verifies:
when x(1)<=min(data) and max(data) <= x(n+1)
Any plot2d (optional) parameter may be provided; for instance to
plot a histogram with the color number 2 (blue if std colormap is used) and
to restrict the plot inside the rectangle [-3,3]x[0,0.5],
you may use histplot(n,data, style=2, rect=[-3,0,3,0.5])
.
Frequency polygon is a line graph drawn by joining all the midpoints of the top of the bins of a histogram.
Therefore we can use histplot
function to plot a polygon frequency chart.
The optional argument polygon
connects the midpoint of the top of each bar of a histogram with straight lines.
If polygon=%t
we will have a histogram with frequency polygon chart.
Enter the command histplot()
to see a demo.
Examples
- Example #1: variations around a histogram of a gaussian random sample
- Example #2: histogram of a binomial (B(6,0.5)) random sample
- Example #3: histogram of an exponential random sample
- Example #4: the frequency polygon chart and the histogram of a gaussian random sample
See Also
Report an issue | ||
<< graypolarplot | 2d_plot | paramfplot2d >> |