Sha256: 6bbf10246c7687d2e202b8b61bdf7e187df480cb2dce30c0b112cd5422c62f40

Contents?: true

Size: 585 Bytes

Versions: 7

Compression:

Stored size: 585 Bytes

Contents

require 'nyaplot'

samples = Array.new(10).map.with_index{|d,i| 'cat'+i.to_s}
address = ['London', 'Kyoto', 'Los Angeles', 'Puretoria']
x=[];y=[];home=[]

10.times do
  x.push(5*rand)
  y.push(5*rand)
  home.push(address.clone.sample)
end
df = Nyaplot::DataFrame.new({x: x,y: y,name: samples, home: home})

plot = Nyaplot::Plot.new
plot.x_label("weight [kg]")
plot.y_label("height [m]")

color = Nyaplot::Colors.qual

sc = plot.add_with_df(df, :scatter, :x, :y)
sc.tooltip_contents([:name, :home])
sc.fill_by(:home)
sc.shape_by(:home)
sc.color(color)

plot.export_html("scatter.html")

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
nyaplot-0.1.6 examples/rb/scatter.rb
nyaplot-0.1.5 examples/rb/scatter.rb
nyaplot-0.1.4 examples/rb/scatter.rb
nyaplot-0.2.0.rc1 examples/rb/scatter.rb
nyaplot-0.1.3 examples/rb/scatter.rb
nyaplot-0.1.2 examples/rb/scatter.rb
nyaplot-0.1.1 examples/rb/scatter.rb