require 'daru' require 'open-uri' content = open('https://raw.githubusercontent.com/v0dro/daru/master/spec/fixtures/music_data.tsv') df = Daru::DataFrame.from_csv content, col_sep: "\t" df.vectors = Daru::Index.new(df.vectors.to_a.map(&:to_sym)) df # Group by artist name and call 'size' to see the number of rows each artist populates. artists = df.group_by(:artname).size artists.max_index top_ten = artists.sort(ascending: false).head top_ten.plot type: :bar do |plt| plt.yrange [0,300] plt.width 1120 plt.height 800 plt.legend true plt.rotate_x_label 45 end