I have five data files each containing separate data. I have plotted them in Gnuplot and superimposed them; at this point I would like to emphasize that Gnuplot automatically chooses different color in printing. After this I set the output of Gnuplot to latex and have the desired data plotted by invoking the following with the load command in Gnuplot:

set terminal latex
set output "spectrum.tex"
set title "Spectrum"
set xlabel "Wavelength (nm)"
set ylabel "Power (cts)"
set ytics 200
set xr [550:750]
set yr [0:3200]
plot "ma3.txt" using 1:2 title"3 mA" with lines, \
"ma5.txt" using 1:2  title"5 mA" with lines, \
"ma10.txt" using 1:2 title"10 mA" with lines, \
"ma15.txt" using 1:2 title"15 mA" with lines, \
"ma20.txt" using 1:2 title"20 mA" with lines

However, when I moved the generated file to the directory where my main tex file reside and compiled to get the pdf output, I noticed that the graphic was entirely in black. I should note that I have included the packages graphicx and color in the preamble part of the source code. I am using Tex Live 2013 and TexMaker as a Latex editor. Thanks for your help in advance. The following is a minimal sample from my Latex document:

\usepackage{a4, color}
\usepackage{amsmath, amsfonts, amssymb}
\input spectrum.tex

  • 2
    The latex terminal doesn't support coloured line styles. Try the epslatex terminal instead (or go with an all-LaTeX solution, like the PGFPlots package)
    – Jake
    Oct 14 '13 at 15:25
  • Okay, thanks for your suggestion I will give it a go.
    – Vesnog
    Oct 14 '13 at 16:50

I saved the graphics as colored encapsulated postscript files. Afterwards I changed the extensions and

    set terminal postscript color enhanced
    set output *.eps 

That worked for me, I posted to inform you. Thank you all for your efforts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.