| 2 | #include <matplot/matplot.h> |
| 3 | |
| 4 | int main() { |
| 5 | using namespace matplot; |
| 6 | |
| 7 | auto xt = [](double t) { return t; }; |
| 8 | auto yt = [](double t) { return t / 2.; }; |
| 9 | auto zt = [](double t) { return sin(6. * t); }; |
| 10 | fplot3(xt, yt, zt, std::array<double, 2>{-2 * pi, 2 * pi}) |
| 11 | ->mesh_density(300) |
| 12 | .line_width(1); |
| 13 | |
| 14 | title("x=t, y=t/2, z=sin(6t) for -2π<t<2π"); |
| 15 | xlabel("x"); |
| 16 | ylabel("y"); |
| 17 | view(52.5, 30); |
| 18 | box(on); |
| 19 | xrange({-2 * pi, +2 * pi}); |
| 20 | yrange({-pi, +pi}); |
| 21 | |
| 22 | auto ax = gca(); |
| 23 | ax->xticks(iota(-2 * pi, pi / 2, 2 * pi)); |
| 24 | ax->x_axis().ticklabels( |
| 25 | {"-2π", "-3π/2", "-π", "-π/2", "0", "π/2", "π", "3π/2", "π"}); |
| 26 | ax->yticks(iota(-pi, pi / 2, pi)); |
| 27 | ax->y_axis().ticklabels({"-π", "-π/2", "0", "π/2", "π"}); |
| 28 | |
| 29 | show(); |
| 30 | return 0; |
| 31 | } |
nothing calls this directly
no test coverage detected