gem 'nyaplot', '0.1.5' require 'nyaplot' samples = Array.new(10).map.with_index{|d,i| 'cat'+i.to_s} x=[];y=[];home=[] 10.times do x.push(5*rand) y.push(5*rand) end df = Nyaplot::DataFrame.new({x:x,y:y,name:samples}) df plot = Nyaplot::Plot.new plot.x_label("weight [kg]") plot.y_label("height [m]") sc = plot.add_with_df(df, :scatter, :x, :y) plot.show sc.tooltip_contents([:name]) plot.show address = ['London', 'Kyoto', 'Los Angeles', 'Puretoria'] home = Array.new(10,'').map{|d| address.clone.sample} df.home = home df sc.tooltip_contents([:name, :home]) plot.show colors = Nyaplot::Colors.qual sc.color(colors) sc.fill_by(:home) plot.show sc.color(colors) sc.shape_by(:home) plot.show path = File.expand_path("../data/first.tab", __FILE__) df = Nyaplot::DataFrame.from_csv(path, sep="\t") df.filter! {|row| row[:set1] != 0.0} df plot4=Nyaplot::Plot.new plot4.add_with_df(df, :histogram, :set1) plot4.configure do height(400) x_label('PNR') y_label('Frequency') filter({target:'x'}) yrange([0,130]) end plot5=Nyaplot::Plot.new plot5.add_with_df(df, :bar, :mutation) plot5.configure do height(400) x_label('Mutation types') y_label('Frequency') yrange([0,100]) end frame = Nyaplot::Frame.new frame.add(plot4) frame.add(plot5) frame.show