160160
161161```julia-repl
162162julia> histogram(randn(1_000) * .1, closed=:right, nbins=15)
163- ┌ ┐
164- (-0.3 , -0.25] ┤▎ 1
165- (-0.25, -0.2 ] ┤██▉ 17
166- (-0.2 , -0.15] ┤█████████▍ 53
167- (-0.15, -0.1 ] ┤████████████████▎ 92
168- (-0.1 , -0.05] ┤████████████████████████▋ 141
169- (-0.05, 0.0 ] ┤███████████████████████████████████ 200
170- ( 0.0 , 0.05] ┤█████████████████████████████████▋ 192
171- ( 0.05, 0.1 ] ┤█████████████████████████▏ 143
172- ( 0.1 , 0.15] ┤████████████████▎ 92
173- ( 0.15, 0.2 ] ┤███████▊ 45
174- ( 0.2 , 0.25] ┤██▋ 15
175- ( 0.25, 0.3 ] ┤█▍ 8
176- ( 0.3 , 0.35] ┤▎ 1
177- └ ┘
178- Frequency
163+ ┌ ┐
164+ (-0.3 , -0.25] ┤▎ 1
165+ (-0.25, -0.2 ] ┤██▉ 17
166+ (-0.2 , -0.15] ┤█████████▍ 53
167+ (-0.15, -0.1 ] ┤████████████████▎ 92
168+ (-0.1 , -0.05] ┤████████████████████████▋ 141
169+ (-0.05, 0.0 ] ┤███████████████████████████████████ 200
170+ ( 0.0 , 0.05] ┤█████████████████████████████████▋ 192
171+ ( 0.05, 0.1 ] ┤█████████████████████████▏ 143
172+ ( 0.1 , 0.15] ┤████████████████▎ 92
173+ ( 0.15, 0.2 ] ┤███████▊ 45
174+ ( 0.2 , 0.25] ┤██▋ 15
175+ ( 0.25, 0.3 ] ┤█▍ 8
176+ ( 0.3 , 0.35] ┤▎ 1
177+ └ ┘
178+ Frequency
179179julia> histogram(randn(100_000) .* .1, nbins=60, vertical=true, height=10)
180- ┌ ┐
181- 8_093 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▃█▇▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
182- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▅████▆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
183- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▇██████▅⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
184- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▅████████▄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
185- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▃██████████▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
186- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▂████████████▂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
187- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▂██████████████▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
188- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▁████████████████▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
189- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▁▅██████████████████▅▁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
190- 0 ⠀⠀⠀⠀⠀⠀▁▁▂▃▅██████████████████████▆▃▂▁▁⠀⠀⠀⠀⠀⠀⠀
191- └ ┘
192- ⠀-0.44⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀0.46⠀
193- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀μ ± σ: 0.0 ± 0.1⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
180+ ┌ ┐
181+ 8_093 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▃█▇▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
182+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▅████▆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
183+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▇██████▅⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
184+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▅████████▄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
185+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▃██████████▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
186+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▂████████████▂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
187+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▂██████████████▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
188+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▁████████████████▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
189+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▁▅██████████████████▅▁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
190+ 0 ⠀⠀⠀⠀⠀⠀▁▁▂▃▅██████████████████████▆▃▂▁▁⠀⠀⠀⠀⠀⠀⠀
191+ └ ┘
192+ ⠀-0.44⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀0.46⠀
193+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀μ ± σ: 0.0 ± 0.1⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
194194```
195195
196196# See also
@@ -207,10 +207,11 @@ function histogram(x::AbstractArray; closed = :left, vertical = false, stats = t
207207 mx, Mx = extrema (x_plot)
208208 μ = sum (x_plot) / len
209209 σ = √ (sum ((x_plot .- μ) .^ 2 ) / len)
210- " μ ± σ: " *
211- lpad (round (μ; digits), digits + 1 ) *
212- " ± " *
213- lpad (round (σ; digits), digits + 1 )
210+ (
211+ " μ ± σ: " *
212+ lpad (round (μ; digits), digits + 1 ) * " ± " *
213+ lpad (round (σ; digits), digits + 1 )
214+ )
214215 else
215216 " "
216217 end
0 commit comments