MCPcopy Create free account
hub / github.com/alandefreitas/matplotplusplus / main

Function main

examples/line_plot/fplot3/fplot3_5.cpp:4–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include <matplot/matplot.h>
3
4int 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}

Callers

nothing calls this directly

Calls 15

fplot3Function · 0.85
xlabelFunction · 0.85
ylabelFunction · 0.85
viewFunction · 0.85
boxFunction · 0.85
xrangeFunction · 0.85
yrangeFunction · 0.85
gcaFunction · 0.85
iotaFunction · 0.85
showFunction · 0.85
mesh_densityMethod · 0.80
xticksMethod · 0.80

Tested by

no test coverage detected