// SPDX-License-Identifier: MIT // SPDX-FileCopyrightText: 2026 Martino Ferrari // The README's embed block, committed as a file: the whole of a minimal GLFW // program (the adapter opens the window, runs the loop and feeds the // controller, and the callback is where live data would be pushed). The // compile command it is verified with is in README.md, next to the same code. #include // the optional GLFW adapter #include #include #include int main() { plot::glfw::Host host; plot::Plot& p = host.plot(); std::vector y(512); for (plot::usize i = 0; i < y.size(); ++i) y[i] = static_cast(std::sin(0.05 * static_cast(i))); plot::data::ArraySeries series(std::move(y), 0.0, 1.0); const plot::u32 x = p.add_x_axis({"x", {0.0, 511.0}, true}); const plot::u32 sig = p.add_y_axis({"signal", {-1.0, 1.0}, true, plot::AxisPlace::Left}); p.add_trace({&series, plot::Color::hex(0x4FA3FF), 1.5f, x, sig, "sine"}); plot::Status st; return host.run({800, 480, "plot"}, [](plot::Plot&, plot::f64) {}, &st) ? 0 : 1; }