Graphics, Figures & TablesAxis Labels of EPS File missing?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Paradigm6790
Posts: 9
Joined: Tue Apr 19, 2011 8:38 pm

Axis Labels of EPS File missing?

Post by Paradigm6790 »

Hello,

I have a problem where I have an eps file I generated in gnuplot that looks exactly the way I want it, and when I put it into my latex document it fits but loses all of it's axis labels. At first I thought it was a cropping issue, but the x axis is between the key and the graph and it still goes missing.

This is the raw eps file:
EPSraw.png
EPSraw.png (68.8 KiB) Viewed 7844 times
Then I add it to my latex document using \includegraphics[keepaspectratio , angle=-90 , width=\textwidth]{graph1.eps} ( I am aware that the aspectratio thing is redundant )

This results in:
EPSincluded.png
EPSincluded.png (37.9 KiB) Viewed 7844 times
I am truly stumped on this one.
Last edited by Paradigm6790 on Tue Jun 14, 2011 11:13 pm, edited 2 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Axis Labels of EPS File missing?

Post by shadgrind »

Did you use the epslatex terminal in gnuplot to create the graph1.eps file? If so, then there should have been two files created: graph1.eps and graph1.tex. The graph1.tex file is what you use in LaTeX, and that file handles the graph1.eps file (including the axis labels) for you. So instead of \includegraphics{graph1.eps}, you would do this:

Code: Select all

\input{graph1}
If you used the postscript terminal in gnuplot, then I'm stumped too, because the axis labels should be in the eps file.
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
Paradigm6790
Posts: 9
Joined: Tue Apr 19, 2011 8:38 pm

Axis Labels of EPS File missing?

Post by Paradigm6790 »

Thanks for the reply, that was exactly my problem. I was using the postscript terminal, but I tried using epslatex and it worked perfectly. It takes up the entire page right now though, but that's an easy fix.

In case others have this issue I'll post my old and new code.

This was the code that had the original problem

Code: Select all


set terminal postscript enhanced color
set size ratio 0.7058
set output 'TR-100/graph1.eps'
set grid

set key font "Arial,10"
set key center bot
set key out vertical
set key horizontal center
set key box

set style line 1  linetype 1 linecolor rgb "red"  linewidth 2.000 pointtype 1 pointsize default
set style line 3  linetype 1 linecolor rgb "#DAA520"  linewidth 2.000 pointtype 3 pointsize default
set style line 4  linetype 1 linecolor rgb "#006400"  linewidth 2.000 pointtype 4 pointsize default
set style line 6  linetype 1 linecolor rgb "blue"  linewidth 2.000 pointtype 6 pointsize default

################################################## GRADIENT ##############################################
set multiplot
set palette model RGB functions 0.8+gray/3, 0.8+gray/3, 0.8+gray/3
set pm3d map
set isosample 100,100

unset colorbox
unset border
unset xtics
unset ytics
set nokey
set nolabel
set size 1.068,1.2
set origin -0.043,-0.032

splot y t ' '
##########################################################################################################

set key box
set key horizontal center bot
set y2tics 0 , 200
set ytics nomirror
set xtics nomirror

set border
set xtics 1
set xtics add (0.1)(0.4)
set xtics font "Arial,8"
set ytics
set size 1,1
set xtics out offset -1,-0.5
set xtics rotate by 45

unset origin
unset x2tics

set xlabel "Loop Length, 26AWG(kft)"
set ylabel "Downstream Data Rate (kbps)
set y2label "Upstream Data Rate (kbps)
set xrange [ 0.1 : 20 ] noreverse nowriteback
set yrange [ 0 : 25000 ] noreverse nowriteback
set y2range[ 0 : 1200 ] noreverse nowriteback
set bmargin  7



plot	"TR-100/ExpectedDS.txt"  ls 4 title 'Expected Downstream Rate' with lines, \
	"TR-100/MeasuredDS.txt" ls 1 title 'Measured Downstream Rate' with lines, \
\
	"TR-100/ExpectedUS.txt"  axes x1y2 ls 6 title 'Expected Upstream Rate' with lines, \
	"TR-100/MeasuredUS.txt"  axes x1y2 ls 3 title 'Measured Upstream Rate' with lines


#unset multiplot

This was the fix

Code: Select all

set terminal epslatex
set size ratio 0.7058
set output 'TR-100/graph1.eps'
set grid

set key font "Arial,10"
set key center bot
set key out vertical
set key horizontal center
set key box

set style line 1  linetype 1 linecolor rgb "red"  linewidth 2.000 pointtype 1 pointsize default
set style line 3  linetype 1 linecolor rgb "#DAA520"  linewidth 2.000 pointtype 3 pointsize default
set style line 4  linetype 1 linecolor rgb "#006400"  linewidth 2.000 pointtype 4 pointsize default
set style line 6  linetype 1 linecolor rgb "blue"  linewidth 2.000 pointtype 6 pointsize default

################################################## GRADIENT ##############################################
set multiplot
set palette model RGB functions 0.8+gray/3, 0.8+gray/3, 0.8+gray/3
set pm3d map
set isosample 100,100

unset colorbox
unset border
unset xtics
unset ytics
set nokey
set nolabel
set size 1.068,1.2
set origin -0.043,-0.032

splot y t ' '
##########################################################################################################

set key box
set key horizontal center bot
set y2tics 0 , 200
set ytics nomirror
set xtics nomirror

set border
set xtics 1
set xtics add (0.1)(0.4)
set xtics font "Arial,8"
set ytics
set size 1,1
set xtics out offset -1,-0.5
set xtics rotate by 45

unset origin
unset x2tics

set xlabel "Loop Length, 26AWG(kft)"
set ylabel "Downstream Data Rate (kbps)
set y2label "Upstream Data Rate (kbps)
set xrange [ 0.1 : 20 ] noreverse nowriteback
set yrange [ 0 : 25000 ] noreverse nowriteback
set y2range[ 0 : 1200 ] noreverse nowriteback
set bmargin  7



plot	"TR-100/ExpectedDS.txt"  ls 4 title 'Expected Downstream Rate' with lines, \
	"TR-100/MeasuredDS.txt" ls 1 title 'Measured Downstream Rate' with lines, \
\
	"TR-100/ExpectedUS.txt"  axes x1y2 ls 6 title 'Expected Upstream Rate' with lines, \
	"TR-100/MeasuredUS.txt"  axes x1y2 ls 3 title 'Measured Upstream Rate' with lines


#unset multiplot

The first line is where the problem was, I included all of my code in case there was a more tricky reason why it wasn't showing up.

Thanks again!
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Axis Labels of EPS File missing?

Post by localghost »

Not directly a solution to your problem. Just an appetizer for future projects. Such diagrams can be done by the brilliant pgfplots package. This solution has advantages and disadvantages.

The advantages are:
  • Full consistency with the font, thus perfect integration into the document.
  • The code can be manipulated from inside your document.
  • Problems as described here don't occur.
The disadvantages are:
  • You have to get familiar with one more package.
  • Now and then a long training period to learn the syntax.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[margin=2cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{shadings}
\usepackage{pgfplots}

\begin{document}
  \begin{tikzpicture}[font=\footnotesize]
    \begin{axis}[%
      name=downstream,
      width=14cm,
      height=10cm,
      axis background/.style={fill,bottom color=gray!50,top color=white},
      grid=major,
      grid style={dotted,black},
      legend style={%
        name=dslegend,
        at={(0.05,-0.15)},
        anchor=north west,
        draw=none
      },
      legend cell align=left,
      xmin=0.1,xmax=20,ymin=0,ymax=25000,
      xlabel={Loop Length, 26AWG (kft)},
      ylabel={Downstream Data Rate (kbps)},
      xlabel near ticks,
      ylabel near ticks,
      xtick={0.1,1,2,...,20},
      extra x ticks={0.4},
      scaled y ticks=false,
      x tick label style={font=\tiny,rotate=45,anchor=north east},
      y tick label style={%
        /pgf/number format/fixed,
        /pgf/number format/1000 sep=
      }
    ]
      \addplot[thick,green!50!black] coordinates {%
        (0.1,10000) (0.4,15000) (4,10000) (6,10000) (10,20000) (12,10000) (16,5000) (20,5000)
      };
      \addlegendentry{Expected Downstream Rate};
      \addplot[thick,red] coordinates {%
        (0.1,5000) (0.4,10000) (4,5000) (6,5000) (10,15000) (12,5000) (16,0) (20,0)
      };
      \addlegendentry{Measured Downstream Rate};
    \end{axis}
    \begin{axis}[%
      name=upstream,
      width=14cm,
      height=10cm,
      legend style={%
        name=uslegend,
        at={(0.95,-0.15)},
        anchor=north east,
        draw=none
      },
      legend cell align=left,
      xmin=0.1,xmax=20,ymin=0,ymax=1200,
      axis x line=none,
      axis y line*=right,
      y tick label style={%
        /pgf/number format/fixed,
        /pgf/number format/1000 sep=
      },
      ylabel={Upstream Data Rate (kbps)},
      ylabel near ticks
    ]
      \addplot[thick,blue!50!black] coordinates {(0.1,1000) (20,1000)};
      \addlegendentry{Expected Upstream Rate};
      \addplot[thick,yellow!75!black] coordinates {(0.1,900) (20,900)};
      \addlegendentry{Measured Upstream Rate};
    \end{axis}
    \draw (dslegend.south west) rectangle (uslegend.north east);
  \end{tikzpicture}
\end{document}

Thorsten
Attachments
The rendered output of the given code.
The rendered output of the given code.
pgfplots-two-y-axis-shaded.png (37.75 KiB) Viewed 7824 times
Post Reply