Sha256: b51c00fff22f98c2018622f8fde16075fae4ef076477c33fa0fb6631ced990cb

Contents?: true

Size: 695 Bytes

Versions: 7

Compression:

Stored size: 695 Bytes

Contents

require 'nyaplot'
require 'mapnya'

raw_df = Nyaplot::Countries.df

hash = [:name, :lat, :lng, :area, :capital].map{|label| {label => raw_df.column(label).to_a}}.reduce({}){|memo, hash| memo.merge(hash)}
df = Nyaplot::DataFrame.new(hash)

color = Nyaplot::Colors.Reds

plot = Nyaplot::MapPlot.new
sc = plot.add_with_df(df, :scatter, :lng, :lat) # x->:lng, y->lat
sc.configure do
  tooltip_contents([:capital, :name, :area])
  color(color)
  size([10, 100000])
  size_by(:area)
  fill_by(:area)
end
plot.export_html("scatter_on_the_map.html")

plot = Nyaplot::MapPlot.new
plot.add_map("AUS")
plot.scale(800)
plot.export_html("australia.html")

plot.add_map("JPN")
plot.export_html("japan.html")

Version data entries

7 entries across 7 versions & 1 rubygems

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