Closed schneems closed 4 years ago
@schneems I released the version 0.0.4. Please use it.
$ irb -Ilib -runicode_plot --simple-prompt
>> UnicodePlot.histogram([1, 2], title: "Histogram").render
Histogram
┌ ┐
[1.0, 1.5) ┤▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 1
[1.5, 2.0) ┤ 0
[2.0, 2.5) ┤▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 1
└ ┘
Frequency
=> nil
>>
Thank you! -- Richard Schneeman https://www.schneems.com
Gives me:
Ruby 2.7.0
It looks like when values get passed to BarChart the arguments include a
nil
:This doesn't appear to happen when rendering a histogram with 1 or 3 items.
Update: It looks like this only happens on specific input numbers, for example this works with no error:
I'm guessing the edge condition has something to do with the calculated bins.