|
12 | 12 | ["Venus", [90, 34, 23, 12, 78, 89, 98, 88]] |
13 | 13 | ] |
14 | 14 | end |
| 15 | + |
| 16 | + context "#area!", focus: true do |
| 17 | + before do |
| 18 | + @temp_dir = SPEC_ROOT + "temp/area" |
| 19 | + @fix_dir = SPEC_ROOT + "fixtures/area" |
| 20 | + FileUtils.mkdir_p @temp_dir |
| 21 | + end |
| 22 | + |
| 23 | + it "plots a single simple Area graph" do |
| 24 | + fig = Rubyplot::Figure.new |
| 25 | + axes = fig.add_subplot 0,0 |
| 26 | + axes.area! do |p| |
| 27 | + p.data [25, 36, 86, 39, 25, 31, 79, 88] |
| 28 | + p.label = "Jimmy" |
| 29 | + end |
| 30 | + axes.title = "Visual simple area graph test." |
| 31 | + axes.x_ticks = { |
| 32 | + 0 => '0', |
| 33 | + 2 => '2', |
| 34 | + 4 => '4', |
| 35 | + 6 => '6' |
| 36 | + } |
| 37 | + |
| 38 | + file = "/#{Rubyplot.backend}_simple_area.png" |
| 39 | + fig.write(@temp_dir + file) |
| 40 | + |
| 41 | + #expect("temp/area" + file).to eq_image("fixtures/area" + file) |
| 42 | + end |
| 43 | + |
| 44 | + it "plots multiple area plots on the same Axes" do |
| 45 | + fig = Rubyplot::Figure.new |
| 46 | + axes = fig.add_subplot 0,0 |
| 47 | + [ |
| 48 | + ["Jimmy", [25, 36, 86, 39, 25, 31, 79, 88]], |
| 49 | + ["Charles", [80, 54, 67, 54, 68, 70, 90, 95]], |
| 50 | + ["Julie", [22, 29, 35, 38, 36, 40, 46, 57]], |
| 51 | + ["Jane", [3, 95, 95, 90, 85, 80, 88, 100]] |
| 52 | + ].each do |n, data| |
| 53 | + axes.area! do |p| |
| 54 | + p.data data |
| 55 | + p.label = n |
| 56 | + end |
| 57 | + end |
| 58 | + axes.title = "Multiple area plots on same axes." |
| 59 | + axes.x_ticks = { |
| 60 | + 0 => '0', |
| 61 | + 2 => '2', |
| 62 | + 4 => '4', |
| 63 | + 6 => '6' |
| 64 | + } |
| 65 | + |
| 66 | + file = "/#{Rubyplot.backend}_multiple_area.png" |
| 67 | + fig.write(@temp_dir + file) |
| 68 | + |
| 69 | + #expect("temp/area" + file).to eq_image("fixtures/area" + file) |
| 70 | + end |
| 71 | + end |
15 | 72 |
|
16 | 73 | context "#line!" do |
17 | 74 | before do |
|
305 | 362 | p.label = "peaches" |
306 | 363 | end |
307 | 364 | axes.title = "Pos/neg bar graph test." |
308 | | - axes.labels = { |
| 365 | + axes.x_ticks = { |
309 | 366 | 0 => '5/6', |
310 | 367 | 1 => '5/15', |
311 | 368 | 2 => '5/24', |
|
322 | 379 | fig = Rubyplot::Figure.new |
323 | 380 | axes = fig.add_subplot 0,0 |
324 | 381 | axes.title = "all negative bar graph." |
325 | | - axes.labels = { |
| 382 | + axes.x_ticks = { |
326 | 383 | 0 => '5/6', |
327 | 384 | 1 => '5/15', |
328 | 385 | 2 => '5/24', |
|
357 | 414 | p.label = name |
358 | 415 | end |
359 | 416 | end |
360 | | - axes.labels = { |
| 417 | + axes.x_ticks = { |
361 | 418 | 0 => '5/6', |
362 | 419 | 1 => '5/15', |
363 | 420 | 2 => '5/24', |
|
385 | 442 | p.label = name |
386 | 443 | end |
387 | 444 | end |
388 | | - axes.labels = { 0 => '2003', 2 => '2004', 4 => '2005' } |
| 445 | + axes.x_ticks = { 0 => '2003', 2 => '2004', 4 => '2005' } |
389 | 446 |
|
390 | 447 | file = "/#{Rubyplot.backend}_adjust_legens.png" |
391 | 448 | fig.write(@temp_dir + file) |
|
0 commit comments