In [1]:
require 'daru/view'
Out[1]:
In [2]:
Daru::View.plotting_library = :googlecharts
Out[2]:
In [3]:
idx = Daru::Index.new ['City', '2010 Population',]
data_rows = [
['New York City, NY', 8175000],
['Los Angeles, CA', 3792000],
['Chicago, IL', 2695000],
['Houston, TX', 2099000],
['Philadelphia, PA', 1526000]
]
df_city_pop = Daru::DataFrame.rows(data_rows)
df_city_pop.vectors = idx
df_city_pop
Out[3]:
In [5]:
bar_basic_options = {
title: 'Population of Largest U.S. Cities',
type: :bar,
}
bar_basic_chart = Daru::View::Plot.new(df_city_pop, bar_basic_options, chart_class: 'Charteditor')
bar_basic_chart.show_in_iruby
Out[5]:
In [ ]: