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

Function main

examples/line_plot/fplot3/fplot3_4.cpp:5–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <thread>
4
5int main() {
6 using namespace matplot;
7
8 auto xt = [](double t) {
9 return exp(-std::abs(t) / 10) * sin(5 * std::abs(t));
10 };
11 auto yt = [](double t) {
12 return exp(-std::abs(t) / 10) * cos(5 * std::abs(t));
13 };
14 auto zt = [](double t) { return t; };
15 auto fp = fplot3(xt, yt, zt)->t_range({-10, 10}).color("r");
16 xlabel("e^{-|z|/10} sin(2|z|)");
17 ylabel("e^{-|z|/10} cos(2|z|)");
18 zlabel("z");
19 grid(true);
20
21 auto ax = gca();
22 float da = ax->azimuth();
23 float de = ax->elevation();
24 for (size_t i = 0; i <= 180; ++i) {
25 view(da + 2 * i, de + i);
26 title("Azimuth: " + num2str(da + 2 * i) +
27 " Elevation: " + num2str(de + i));
28 std::this_thread::sleep_for(std::chrono::milliseconds(50));
29 }
30
31 show();
32 return 0;
33}

Callers

nothing calls this directly

Calls 13

fplot3Function · 0.85
xlabelFunction · 0.85
ylabelFunction · 0.85
zlabelFunction · 0.85
gridFunction · 0.85
gcaFunction · 0.85
viewFunction · 0.85
num2strFunction · 0.85
showFunction · 0.85
azimuthMethod · 0.80
elevationMethod · 0.80
titleFunction · 0.50

Tested by

no test coverage detected