ruby-numo / numo-gnuplot

Gnuplot wrapper for Ruby/Numo
BSD 3-Clause "New" or "Revised" License
51 stars 8 forks source link

横に並んだ棒グラフが描きたい #12

Closed kojix2 closed 7 years ago

kojix2 commented 7 years ago

お忙しいところ申し訳ございません. 大変暑い日が続いていますが日本語で失礼します. 棒グラフを表示したいのですが、下記のように書くと

require 'numo/gnuplot'

a = Array.new(10) { |i| i }
b = Array.new(10) { |i| 2 * i }
c = Array.new(10) { |i| 3 * i }
d = Array.new(10) { |i| 4 * i }
data = [a, b, c, d]

Numo.gnuplot do
  debug_on
  set style: [histogram: :clustered]
  set style: [fill: :solid]
  plot [*data, using: 1, w: :histogram, t: 'A'],
       [*data, using: 2, w: :histogram, t: 'B'],
       [*data, using: 3, w: :histogram, t: 'C'],
       [*data, using: 4, w: :histogram, t: 'D']
end

次のような表示になります output

アウトプットはこんな感じでした

set style histogram clustered
set style fill solid
set term png
set output "output.png"
plot '-' using 1 w histogram t "A", '-' using 2 w histogram t "B", '-' using 3 w histogram t "C", '-' using 4 w histogram t "D"
0 0 0 0
1 2 3 4
...
9 18 27 36
e

'B' 'C' 'D' の一番最後が表示されていません。、きちんと表示するにはどうすればよいでしょうか? これはnumo-gnuplotの問題ではない気もしますが念のため報告します。

masa16 commented 7 years ago

numo-gnuplot のバグでした。ご指摘ありがとうございます。 親切な方が直してくれていました。ありがとうございます> https://github.com/ruby-numo/gnuplot/commit/15eab6169b81db31cb7504e45c1a5975df5d49da

kojix2 commented 7 years ago

きちんと表示されました。ありがとうございました。 histogram