BenchmarkTools @benchmark beautiful histogram reuse

So you want to plot a histogram of your own data (just any data, not benchmarking results) using the histogram from BenchmarkTools?

The relevant code is here:

https://github.com/JuliaCI/BenchmarkTools.jl/blob/4da9aaf5ccb9d8ab475566c1690b422e253b7f61/src/trials.jl#L293

Although I probably would just use UnicodePlots to create plots in the terminal (either standalone or as a Plots backend):

julia> using UnicodePlots

julia> histogram(randn(10_000), xlabel = "Something", ylabel = "Something else")
                               ┌                                        ┐ 
                  [-5.0, -4.0) ┤▏ 1                                       
                  [-4.0, -3.0) ┤▎ 19                                      
                  [-3.0, -2.0) ┤██▎ 217                                   
                  [-2.0, -1.0) ┤█████████████▎ 1342                       
   Something else [-1.0,  0.0) ┤██████████████████████████████████  3454  
                  [ 0.0,  1.0) ┤█████████████████████████████████▏ 3359   
                  [ 1.0,  2.0) ┤█████████████▋ 1385                       
                  [ 2.0,  3.0) ┤██▎ 212                                   
                  [ 3.0,  4.0) ┤▎ 10                                      
                  [ 4.0,  5.0) ┤▏ 1                                       
                               └                                        ┘ 
                                                Something
2 Likes