Created
August 20, 2018 04:42
-
-
Save arafatkatze/e1b745707ee82aa3f302bcc1b84cd703 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubyplot' | |
@datasets = [ | |
[[20, 10, 5, 12, 11, 6, 10, 7], :Anna], | |
[[5, 10, 20, 6, 9, 12, 14, 8], :Jack], | |
[[19, 9, 6, 11, 12, 7, 15, 8], :Katie] | |
] | |
plot = Rubyplot::StackedBar.new(1000) | |
plot.title = 'Net earnings in different months' | |
plot.labels = { | |
0 => 'Jan', | |
1 => 'Feb', | |
2 => 'March', | |
3 => 'April', | |
4 => 'May', | |
5 => 'June', | |
6 => 'July', | |
7 => 'August', | |
8 => 'September', | |
9 => 'October', | |
10 => 'November', | |
11 => 'December' | |
} | |
@datasets.each do |data| | |
plot.data data[0], label: data[1] | |
end | |
plot.write('stacked_bar_test_1.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment