Trase is a lightweight scientific plotting library for C++ with animation support. It enables you to construct plots and write them out to animated svg files, or display them in an OpenGL window. The main library and svg backend have no dependencies other than the standard library. The OpenGL backend requires GLFW.
For example, the above svg image was generated with the following code.
moving_plot->add_frame(get_ysinx(amplitude, 5.f), 3.f * i / nf);
}
// set label axes
ax->xlabel("x");
ax->ylabel("y");
ax->title("the svg test");
ax->legend();
// output to svg
std::ofstream out;
out.open("readme.svg");
BackendSVG backend(out);
fig->draw(backend);
out.close();
Contributing to Trase
We welcome community pull requests for Trase, please see the guidelines here. Potential areas for changes are:
Bug-fixes. Please add a relevant test in tests/ demonstrating the fixed bug.
New geometry, aesthetic or transform. The design of Trase roughly follows the Grammer of Graphics, so looking at existing GOG packages such as ggplot could give you some good ideas
New example showing how to use Trase. All the examples shown in the documentation are in examples/.
New drawing backend. There are two main types of backend. Classes derived from Backend are "pure" drawing classes in the same vein as NanoVG, while those derived from AnimatedBackend can also draw shapes or paths that have properties which animate over time.
Build and install Trase. This uses an install dir of $HOME/trase, change this to wherever you like. This also builds the OpenGL backend of Trase (requires GLFW installed), switch this to OFF if you only want the svg backend.