| 1 | #include <matplot/matplot.h> |
| 2 | |
| 3 | int main() { |
| 4 | using namespace matplot; |
| 5 | |
| 6 | std::vector<std::vector<double>> Y = { |
| 7 | {1, 3, 1, 2}, {5, 2, 5, 6}, {3, 7, 3, 1}}; |
| 8 | |
| 9 | auto f = gcf(); |
| 10 | f->width(f->width() * 2); |
| 11 | |
| 12 | subplot(1, 2, 0); |
| 13 | auto h1 = area(Y, -4.); |
| 14 | h1[0]->line_style(":"); |
| 15 | h1[1]->line_style(":"); |
| 16 | h1[2]->line_style(":"); |
| 17 | h1[0]->face_color({0, 0, 0.25, 0.25}); |
| 18 | h1[1]->face_color({0, 0, 0.5, 0.5}); |
| 19 | h1[2]->face_color({0, 0, 0.75, 0.75}); |
| 20 | title("Stacked"); |
| 21 | |
| 22 | subplot(1, 2, 1); |
| 23 | auto h2 = area(Y, -4, false); |
| 24 | h2[0]->line_style(":"); |
| 25 | h2[1]->line_style(":"); |
| 26 | h2[2]->line_style(":"); |
| 27 | h2[0]->face_color({0.2f, 0.f, 0.25f, 0.25f}); |
| 28 | h2[1]->face_color({0.2f, 0.f, 0.5f, 0.5f}); |
| 29 | h2[2]->face_color({0.2f, 0.f, 0.75f, 0.75f}); |
| 30 | title("Not stacked"); |
| 31 | |
| 32 | show(); |
| 33 | return 0; |
| 34 | } |