This is an example for the line geometry
#include <fstream>
int main() {
auto ax = fig->axis();
const int n = 100;
std::vector<float> x(n);
std::vector<float> y(n);
for (int i = 0; i < n; ++i) {
x[i] = 6.28f * static_cast<float>(i) / n;
y[i] = std::sin(x[i]);
}
auto data = create_data().x(x).y(y);
auto plt = ax->line(data);
ax->xlabel("x");
ax->ylabel("y");
#ifdef TRASE_EXAMPLES_SVG_BACKEND
std::ofstream out;
out.open("example_line.svg");
fig->draw(backend);
out.close();
#endif
#ifdef TRASE_EXAMPLES_GL_BACKEND
fig->show(backend);
#endif
}