require 'nyaplot'
true
plot = Nyaplot::Plot.new
bar = plot.add(:bar, ['Persian', 'Maine Coon', 'American Shorthair'], [10,20,30])
#<Nyaplot::Diagram:0x007f3fd6a5ea98 @properties={:type=>:bar, :options=>{:x=>"data0", :y=>"data1"}, :data=>"fcdb4e42-a4ac-484a-bd78-8422e6896bd1"}, @xrange=["Persian", "Maine Coon", "American Shorthair"], @yrange=[0, 30]>
plot.show
plot.x_label("Species")
plot.y_label("Number")
plot.show
colors = Nyaplot::Colors.qual
rgb(228,26,28) | rgb(55,126,184) | rgb(77,175,74) | rgb(152,78,163) | rgb(255,127,0) | rgb(255,255,51) | rgb(166,86,40) | rgb(247,129,191) | rgb(153,153,153) |
---|---|---|---|---|---|---|---|---|
bar.color(colors)
plot.show
df = Nyaplot::DataFrame.new({species: ['Persian', 'Maine Coon', 'American Shorthair'], number: [10,20,30]})
species | number |
---|---|
Persian | 10 |
Maine Coon | 20 |
American Shorthair | 30 |