| 2 | #include <matplot/matplot.h> |
| 3 | |
| 4 | int main() { |
| 5 | using namespace matplot; |
| 6 | |
| 7 | std::vector<double> x = linspace(0, 3); |
| 8 | std::vector<double> y1 = transform(x, [](auto x) { return sin(5 * x); }); |
| 9 | std::vector<double> y2 = transform(x, [](auto x) { return sin(15 * x); }); |
| 10 | |
| 11 | tiledlayout(2, 1); |
| 12 | auto ax1 = nexttile(); |
| 13 | plot(ax1, x, y1); |
| 14 | title(ax1, "Top Plot"); |
| 15 | ylabel(ax1, "sin(5x)"); |
| 16 | |
| 17 | auto ax2 = nexttile(); |
| 18 | plot(ax2, x, y2); |
| 19 | title(ax2, "Bottom Plot"); |
| 20 | ylabel(ax2, "sin(15x)"); |
| 21 | |
| 22 | show(); |
| 23 | return 0; |
| 24 | } |