main

CTikz
CTikz is a C++ class to create TikZ files for LaTeX out of a data array. Source code and examples can be found on github: CTikz - c++ class for LaTeX TikZ
When writing thesis or paper in LaTeX and you have done data analysis in C++ or don't like the default Matlab graphics then CTikz can be used to create TikZ files for your LaTeX document. CTikz can be seen as a C++ to Tikz converter. This C++ class CTikz creates TikZ files and as preview a pdf of the graphic. It is suitable to create charts out of a C data array (double x[10]) or data vector (std::vector x) from C++.

        #include "CTikz.hpp"

        int main(int argc, const char * argv[]) {
          
          // example code to create data (y = x*x)
          const int N = 100;
          double x_array[N];
          double y_array[N];
          int idx = 0;
          for (int x=-N/2; x < N/2; ++x) {
            int y = x * x;
            x_array[idx] = x;
            y_array[idx] = y;
            ++idx;
          }

          // create CTikz object
          CTikz tikz;

          // add data
          tikz.addData(x_array, y_array, N);

          // create tikz file and PDF as preview
          tikz.createTikzPdf("example.tikz");

          return 0;
        }
      
      





Impressum