0

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

enter image description here

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

T.pdf : enter image description here

enter image description here

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?

Naghi
  • 284
  • Did you try to do it with pstricks? – Bernard Jan 27 '21 at 18:27
  • @Bernard I don't know what is it; so, what is it !? – Naghi Jan 27 '21 at 18:50
  • @Bernard Can you tell me how should I use pstricks in my problem? – Naghi Jan 27 '21 at 19:24
  • You can plot functions with the pst-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 with xelatex --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:31
  • For your first question, pstricks is a package which is a sort of interface between latex and Adobe postscript. – Bernard Jan 27 '21 at 19:33
  • @Bernard I used sin(x) here only for the purpose of illustration. My actual data is a two-column text file which I plot it using gnuplot; 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
  • ?? How can you plot a text file? Maybe you mean some .csv file? – Bernard Jan 27 '21 at 19:38
  • @Bernard It is a raw file (no extension in the file name) with two numerical columns where the delimiter between the columns is space. – Naghi Jan 27 '21 at 20:52

0 Answers0