forked from alandefreitas/matplotplusplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fplot3_5.cpp
31 lines (26 loc) · 831 Bytes
/
fplot3_5.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cmath>
#include <matplot/matplot.h>
int main() {
using namespace matplot;
auto xt = [](double t) { return t; };
auto yt = [](double t) { return t / 2.; };
auto zt = [](double t) { return sin(6. * t); };
fplot3(xt, yt, zt, std::array<double, 2>{-2 * pi, 2 * pi})
->mesh_density(300)
.line_width(1);
title("x=t, y=t/2, z=sin(6t) for -2π<t<2π");
xlabel("x");
ylabel("y");
view(52.5, 30);
box(on);
xrange({-2 * pi, +2 * pi});
yrange({-pi, +pi});
auto ax = gca();
ax->xticks(iota(-2 * pi, pi / 2, 2 * pi));
ax->x_axis().ticklabels(
{"-2π", "-3π/2", "-π", "-π/2", "0", "π/2", "π", "3π/2", "π"});
ax->yticks(iota(-pi, pi / 2, pi));
ax->y_axis().ticklabels({"-π", "-π/2", "0", "π/2", "π"});
show();
return 0;
}