Mercurial > octave-nkf
comparison scripts/plot/draw/stemleaf.m @ 19630:0e1f5a750d00
maint: Periodic merge of gui-release to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 20 Jan 2015 10:24:46 -0500 |
parents | 4f43f87b7c3e 446c46af4b42 |
children | 4197fc428c7d |
comparison
equal
deleted
inserted
replaced
19626:37d37297acf8 | 19630:0e1f5a750d00 |
---|---|
47 ## | 47 ## |
48 ## Fenced Letter Display | 48 ## Fenced Letter Display |
49 ## #% nx|___________________ nx = numel (x) | 49 ## #% nx|___________________ nx = numel (x) |
50 ## M% mi| md | mi median index, md median | 50 ## M% mi| md | mi median index, md median |
51 ## H% hi|hl hu| hs hi lower hinge index, hl,hu hinges, | 51 ## H% hi|hl hu| hs hi lower hinge index, hl,hu hinges, |
52 ## 1 |x(1) x(nx)| hs h_spreadx(1), x(nx) first | 52 ## 1 |x(1) x(nx)| hs h_spreadx(1), x(nx) first |
53 ## _______ and last data value. | 53 ## _______ and last data value. |
54 ## ______|step |_______ step 1.5*h_spread | 54 ## ______|step |_______ step 1.5*h_spread |
55 ## f|ifl ifh| inner fence, lower and higher | 55 ## f|ifl ifh| inner fence, lower and higher |
56 ## |nfl nfh| no.\ of data points within fences | 56 ## |nfl nfh| no.\ of data points within fences |
57 ## F|ofl ofh| outer fence, lower and higher | 57 ## F|ofl ofh| outer fence, lower and higher |
63 ## The stem-and-leaf plot shows on each line the stem value followed by the | 63 ## The stem-and-leaf plot shows on each line the stem value followed by the |
64 ## string made up of the leaf digits. If the @var{stem_sz} is not 1 the | 64 ## string made up of the leaf digits. If the @var{stem_sz} is not 1 the |
65 ## successive leaf values are separated by ",". | 65 ## successive leaf values are separated by ",". |
66 ## | 66 ## |
67 ## With no return argument, the plot is immediately displayed. If an output | 67 ## With no return argument, the plot is immediately displayed. If an output |
68 ## argument is provided, the plot is returned as an array of strings. | 68 ## argument is provided, the plot is returned as an array of strings. |
69 ## | 69 ## |
70 ## The leaf digits are not sorted. If sorted leaf values are desired, use | 70 ## The leaf digits are not sorted. If sorted leaf values are desired, use |
71 ## @code{@var{xs} = sort (@var{x})} before calling @code{stemleaf (@var{xs})}. | 71 ## @code{@var{xs} = sort (@var{x})} before calling @code{stemleaf (@var{xs})}. |
72 ## | 72 ## |
73 ## The stem and leaf plot and associated displays are described in: | 73 ## The stem and leaf plot and associated displays are described in: |
74 ## Ch. 3, @cite{Exploratory Data Analysis} by J. W. Tukey, Addison-Wesley, 1977. | 74 ## Ch. 3, @cite{Exploratory Data Analysis} by J. W. Tukey, Addison-Wesley, 1977. |
75 ## @seealso{hist, printd} | 75 ## @seealso{hist, printd} |
76 ## @end deftypefn | 76 ## @end deftypefn |
77 | 77 |
78 ## Author: Michael D. Godfrey <michaeldgodfrey@gmail.com> | 78 ## Author: Michael D. Godfrey <michaeldgodfrey@gmail.com> |
202 plot_out = [plot_out; sprintf(" ")]; | 202 plot_out = [plot_out; sprintf(" ")]; |
203 plot_out = [plot_out; sprintf(" #%3d|___________________", nx)]; | 203 plot_out = [plot_out; sprintf(" #%3d|___________________", nx)]; |
204 plot_out = [plot_out; sprintf(" M%3d| %5d |", mdidx, md)]; | 204 plot_out = [plot_out; sprintf(" M%3d| %5d |", mdidx, md)]; |
205 plot_out = [plot_out; sprintf(" H%3d|%5d %5d| %d", hlidx, hl, hu, h_spread)]; | 205 plot_out = [plot_out; sprintf(" H%3d|%5d %5d| %d", hlidx, hl, hu, h_spread)]; |
206 plot_out = [plot_out; sprintf(" 1 |%5d %5d|", xs(1), xs(nx))]; | 206 plot_out = [plot_out; sprintf(" 1 |%5d %5d|", xs(1), xs(nx))]; |
207 plot_out = [plot_out; sprintf(" _______")]; | 207 plot_out = [plot_out; sprintf(" _______")]; |
208 plot_out = [plot_out; sprintf(" ______|%5d|_______",step)]; | 208 plot_out = [plot_out; sprintf(" ______|%5d|_______",step)]; |
209 plot_out = [plot_out; sprintf(" f|%5d %5d|", i_fence_l, i_fence_h)]; | 209 plot_out = [plot_out; sprintf(" f|%5d %5d|", i_fence_l, i_fence_h)]; |
210 plot_out = [plot_out; sprintf(" |%5d %5d| out", n_out_l, n_out_h)]; | 210 plot_out = [plot_out; sprintf(" |%5d %5d| out", n_out_l, n_out_h)]; |
211 plot_out = [plot_out; sprintf(" F|%5d %5g|", o_fence_l, o_fence_h)]; | 211 plot_out = [plot_out; sprintf(" F|%5d %5g|", o_fence_l, o_fence_h)]; |
212 plot_out = [plot_out; sprintf(" |%5d %5d| far",n_far_l,n_far_h)]; | 212 plot_out = [plot_out; sprintf(" |%5d %5d| far",n_far_l,n_far_h)]; |
286 | 286 |
287 if (! isempty (lf_str) || stems(kx) == 0 || stems(kx-1) == 0) | 287 if (! isempty (lf_str) || stems(kx) == 0 || stems(kx-1) == 0) |
288 plot_out = [plot_out; line]; | 288 plot_out = [plot_out; line]; |
289 new_line = 1; | 289 new_line = 1; |
290 else | 290 else |
291 if (new_line == 1) | 291 if (new_line == 1) |
292 plot_out = [plot_out; " :"]; # just print one : if no leaves | 292 plot_out = [plot_out; " :"]; # just print one : if no leaves |
293 new_line = 0; | 293 new_line = 0; |
294 endif | 294 endif |
295 endif | 295 endif |
296 | 296 |