require 'gnuplotrb' require 'daru' include GnuplotRB dv = Daru::Vector.new [:a, :a, :a, :b, :b], type: :category Plot.new [dv.frequencies, with: 'histogram'], xrange: -1..2, yrange: 0..10 Plot.new [dv.frequencies(:percentage), with: 'histogram'], xrange: -1..2, yrange: 0..100 df = Daru::DataFrame.new({ x: [1, 2, 3, 4, 5, 6, 7, 8], y: [3, 2, 3, 5, 6, 1, 2, 3], cat: ['III', 'II', 'I', 'I', 'II', 'I', 'III', 'III'] }) df[:cat] = df[:cat].to_category categories: ['I', 'II', 'III'] df[:cat].type dfs = df.split_by_category :cat # The line below is because of this issue: https://github.com/SciRuby/gnuplotrb/issues/8 dfs.each { |df| df.index = df.nrows.times.to_a } ### Plot.new( *dfs.map { |df| [df, using: 'x:y'] }, xrange: 0..10, yrange: 0..10 )