If you can't do it in sciplot, you could try morphologica, which has a QuiverVisual
class for plotting vector fields. It's 2D GraphVisual
class is also able to do this. A short example program that draws three quivers for a three element vector field is:
#include <vector>
#include <morph/vec.h>
#include <morph/Visual.h>
#include <morph/ColourMap.h>
#include <morph/QuiverVisual.h>
int main()
{
morph::Visual scene(1024, 768, "morph::QuiverVisual"); // Create 1024x768 pix window
// Define a vector field
std::vector<morph::vec<float, 3>> coords = { {0,0,0}, {0,1,0}, {1,0,0} };
std::vector<morph::vec<float, 3>> quivs = { {0,0,1}, {0,-.3,1.1}, {-.3,0,1.2} };
// Create the QuiverVisual VisualModel with make_unique
auto vmp = std::make_unique<morph::QuiverVisual<float>>(&coords, morph::vec<float, 3>{0}, &quivs,
morph::ColourMapType::Viridis);
scene.bindmodel (vmp); // boilerplate - wires up callbacks
vmp->do_quiver_length_scaling = false; // Avoid scaling the quiver lengths
vmp->finalize(); // builds the OpenGL vertices
scene.addVisualModel (vmp); // Adds the QuiverVisual to the scene
scene.keepOpen(); // Render until user quits with Ctrl-q
return 0;
}
Looks like: A screenshot of the morph::Visual window displaying a QuiverVisual (and the scene coordinate arrows)
For more options/example code see:
https://github.com/ABRG-Models/morphologica/blob/main/examples/showcase.cpp#L335
and
https://github.com/ABRG-Models/morphologica/blob/main/examples/quiver.cpp