Graphics, Figures & Tables ⇒ Axis Labels of EPS File missing?
-
- Posts: 9
- Joined: Tue Apr 19, 2011 8:38 pm
Axis Labels of EPS File missing?
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: 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: I am truly stumped on this one.
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
Axis Labels of EPS File missing?
Code: Select all
\input{graph1}
-
- Posts: 9
- Joined: Tue Apr 19, 2011 8:38 pm
Axis Labels of EPS File missing?
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
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
Thanks again!
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Axis Labels of EPS File missing?
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.
- 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.
- pgfplots-two-y-axis-shaded.png (37.75 KiB) Viewed 7827 times
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10