Gnuplot has inbuilt capability to write any equation in LATEX format. What it does is, it divides the image in two parts, in one part, it plots required image/curve (in filename.ps format), in the other part, it encodes the texts/titles/labels etc. in
filename.tex format. Once these two files are produced, you can go the main latex page where the image is to be inserted and insert
the gnuplot produced latex like adding some graphics (examples are given here). After you compile the main latex, you will see that
the curve has been put with latex type equations written on it.
To produce images in gnuplot with latex environment (which can write texts in latex format), follow the rules -
1) set the terminal type to epslatex -
set term epslatex color
set output "filename.tex"
2) give plot command to plot something or load a file which contains all the plotting commands (example:
plot_filename.gn ). You can use the latex format while writting the text/ title etc., just put
double backslash ("\\") infront of the commands (like "\\int" instead of "\int" ). One slash is
used by the gnuplot to print the next "\" in the output file. Also never forget to put the expressions within
"$$" symbol.
>> load "plot_filename.gn"
inside the gnuplot command promt or $ gnuplot plot_filename.gn
from the terminal.
3) The above commands will produce two files, one is the image file (like filename.eps, if
the file has some other name, rename it), another
is a latex file which contains all the information about the texts (like: filename.tex).
4) Now copy both the files to the directory where your main latex (say a report) is present and insert the "filename.tex"
file as a figure and run it.
\begin{figure}[h]
\begin{center}
\input{filename.tex}
\end{center}
\end{figure}
Here is an exapmle of such a main latex file - main_latex.tex and its output - main_latex.ps. You can also change the color/style/texts by editing the gnuplot produced .tex file.