SigPack - the C++ signal processing library
 
Loading...
Searching...
No Matches
latex.cpp

The Gnuplot output terminal 'epslatex' generates two output files, one .eps with the actual plot and one file .tex with the text in Latex format. To include the file use \input{filename.tex}

\documentclass[11pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{xcolor}
\begin{document}
\begin{figure}
\input{test.tex}
\end{figure}
\end{document}

Output

Source

#include "sigpack.h"
using namespace arma;
using namespace sp;
int main()
{
int N = 512;
vec x(N), y(N);
gplot gp;
x = linspace(-5, 5, N);
y = exp(-(x - 1) % (x - 1) / datum::pi);
gp.set_output("test.tex");
gp.label(-4, 0.5, " $f(x)=e^{-\\\\frac{(x-1)^2}{\\\\pi}} $");
gp.xlim(-5, 5);
gp.plot_add(x, y, "");
gp.plot_show();
return 0;
}
int main()
Gnuplot class.
Definition gplot.h:27
void plot_show(void)
Show plots.
Definition gplot.h:401
void set_output(const char *name)
Save plot to file.
Definition gplot.h:690
void xlim(const double xmin, const double xmax)
Set X-axis range.
Definition gplot.h:297
void plot_add(const T1 &x, const T2 &y, const std::string lb, const std::string ls="lines")
Push plot y vs. x with label and linespec.
Definition gplot.h:325
void label(const double &x, const double &y, const char *label)
Set label at position x,y.
Definition gplot.h:272
Definition base.h:8