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

Function main

examples/line_plot/fplot/fplot_6.cpp:4–21  ·  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 fplot([](double x) { return sin(x); },
8 std::array<double, 2>{-2 * pi, 2 * pi});
9 grid(on);
10 title("sin(x) from -2π to 2π");
11 xlabel("x");
12 ylabel("y");
13
14 auto ax = gca();
15 ax->x_axis().tick_values(iota(-2 * pi, pi / 2, 2 * pi));
16 ax->x_axis().ticklabels(
17 {"-2π", "-3π/2", "-π", "-π/2", "0", "π/2", "π", "3π/2", "2π"});
18
19 show();
20 return 0;
21}

Callers

nothing calls this directly

Calls 8

fplotFunction · 0.85
gridFunction · 0.85
xlabelFunction · 0.85
ylabelFunction · 0.85
gcaFunction · 0.85
iotaFunction · 0.85
showFunction · 0.85
titleFunction · 0.50

Tested by

no test coverage detected