I would like to superimpose table on a plot with using gnuplot. Basically, I have table values and want to create a table and add it on the signal plot.
1 Answer
This can be done using the epslatex terminal and using set label, defining the table using latex syntax. A minimal example:
Within gnuplot do:
set term epslatex
set output "plot.eps"
set label at screen 0.5,0.5 '\begin{tabular}{c c}1 & 2 \\ 3 & 4\end{tabular}'
plot sin(x)
Then create a latex file document.tex with the following code:
\documentclass{article}
\usepackage[papersize={100cm,100cm}]{geometry}
\usepackage{graphicx}
\begin{document}
\thispagestyle{empty}
\include{plot}
\end{document}
Then run
latex document.tex
dvipdf document.dvi
pdfcrop document.pdf
The final output is document-crop.pdf, which will now look like this:

You can use latex syntax to further format the table, and obviously all the different gnuplot options compatible with the epslatex terminal.
2 Comments
Christoph
No need to use a separate LaTeX document, just use
set terminal epslatex standalone.Christoph
Yes, if you have only a few packages, you can use the
header option like set terminal epslatex standalone header "\\usepackage[T1]{fontenc}\\usepackage{lmodern}". Or you can create a file gnuplot.cfg which contains all the required packages, and put it in the TeX-path.