Here is my code to plot single order of bessel function with CImg:
#include "libs/CImg-master/CImg.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <boost/math/special_functions/bessel.hpp>
using namespace cimg_library;
using namespace std;
int main(int argc, char** const argv)
{
cimg_usage("Simple plotter of mathematical formulas");
const char *const formula = cimg_option("-f", "First kind of bessel function", "Function to plot");
const float x0 = cimg_option("-x0", -5.0f, "Minimal X-value");
const float x1 = cimg_option("-x1", 5.0f, "Maximal X-value");
const int resolution = cimg_option("-r", 5000, "Plot resolution");
const unsigned int nresolution = resolution>1 ? resolution : 5000;
const unsigned int plot_type = cimg_option("-p", 1, "Plot type");
const unsigned int vertex_type = cimg_option("-v", 1, "Vertex type");
const int bessel_order = cimg_option("-bo", 1, "bessel_order");
const unsigned int r = nresolution - 1;
CImg<double> values1(1, nresolution, 1, 1, 0); // Create plot data.
for (int i1 = 0; i1 < resolution; ++i1)
{
double xtime = x0 + i1\*(x1 - x0) / r;
values1(0, i1) = boost::math::cyl_bessel_j<int, double>(bessel_order, xtime);
}
CImg<double> values;
values = values1.display_graph(formula, plot_type, vertex_type, "X Axis", x0, x1, "Y Axis");
}
I want to plot multi order of bessel function within one plot? like this: enter image description here
Is this possible for CImg?