When I use the following gnuplot code and then compile the generated tex file with latex and dvipdf commands, I simply get what I want.
gnuplot code:
set terminal epslatex standalone
set output "plot.tex"
plot sin(x)
compilation code:
latex plot.tex
dvipdf plot.dvi
Now I want to use dvipdfm instead of dvipdf, since I want to include an image (named T.pdf)
in my plot area using \includegraphics{T.pdf} (with dvipdf, it is not
possible, from here). To do so, I follow the following listings, but I get the figure below.
gnuplot code:
set terminal epslatex standalone
set output "plot.tex"
set label at screen 0.5,0.5 '\includegraphics[natwidth=.5in,natheight=.5in,scale=.25]{T.pdf}'
plot sin(x)
compilation code:
latex plot.tex
dvipdfm plot.dvi
As you can see, the plot is misaligned with respect to the texts. Passing the
option dvipdfm in the preamble, i.e. \usepackage[dvipdfm]{graphicx} in plot.tex also
doesn't solve the problem.
Question
My question is simply, how to generate the correct figure when including an image in the plot area as well?



pstricks? – Bernard Jan 27 '21 at 18:27pstricksin my problem? – Naghi Jan 27 '21 at 19:24pst-plot package. Take a look at its documentation, which has many examples, and ask a question if you have any difficulty. Note it's simpler to compile withxelatex --shell-escape. The fundamental command f or the sine function would simply be\psplot[algebraic]{-10}{10}{sin(x)}. – Bernard Jan 27 '21 at 19:31pstricksis a package which is a sort of interface between latex and Adobe postscript. – Bernard Jan 27 '21 at 19:33sin(x)here only for the purpose of illustration. My actual data is a two-column text file which I plot it usinggnuplot; but I have the same problem there, i.e., the plot is misaligned with regard to the texts. – Naghi Jan 27 '21 at 19:35