| 2 | #include <matplot/matplot.h> |
| 3 | |
| 4 | int main() { |
| 5 | using namespace matplot; |
| 6 | std::vector<double> x = linspace(0, 2 * pi); |
| 7 | std::vector<double> y = transform(x, [](auto x) { return sin(x); }); |
| 8 | |
| 9 | plot(x, y, "-o"); |
| 10 | hold(on); |
| 11 | plot(x, transform(y, [](auto y) { return -y; }), "--xr"); |
| 12 | plot(x, transform(x, [](auto x) { return x / pi - 1.; }), "-:gs"); |
| 13 | plot({1.0, 0.7, 0.4, 0.0, -0.4, -0.7, -1}, "k"); |
| 14 | |
| 15 | show(); |
| 16 | return 0; |
| 17 | } |