I wrote the code for a plot in gnuplot and set the output using epslatex terminal as follows:
set term epslatex color
set output "test.tex"
set multiplot layout 2,3 columnsfirst margins 0.1,0.9,0.1,0.9 spacing 0.07,0.0
unset key
set format x " "
#set xtic 400
#set ytic 100
#unset xlabel
set yrange [0:150]
set title "D1"
plot [0:10] x**2 lc -1 lw 2 with lines , [0:5] x**3 lc rgb "#FF4433" pt 5 ps 0.7
#unset key
unset format x
unset title
plot [0:10] x**2 lc -1 lw 2 with lines , [0:5] x**3 lc rgb "#FF4433" pt 5 ps 0.7
set format x " "
set title "D2"
plot [0:10] x**2 lc -1 lw 2 with lines , [0:5] x**3 lc rgb "#FF4433" pt 5 ps 0.7
unset format x
unset title
plot [0:10] x**2 lc -1 lw 2 with lines , [0:5] x**3 lc rgb "#FF4433" pt 5 ps 0.7
set format x " "
set title "D3"
plot [0:10] x**2 lc -1 lw 2 with lines , [0:5] x**3 lc rgb "#FF4433" pt 5 ps 0.7
unset format x
unset title
set label 1 "$x $" at screen 0.47,0.04
set label 2 "$f(x)$" at screen 0.05,0.43 rotate by 90
set label 3 "$ (a)\\; NK $" at -25.2696,239.562
set label 4 "$ (b) \\; NKH \\Delta $" at -25.4174,102,370
set key at -22.5856,276.937 box
plot [0:10] x**2 title "$ x^2 $" lc -1 lw 2 with lines , [0:5] x**3 title "$ x^3 $" lc rgb "#FF4433" pt 5 ps 0.7
unset label 1
unset label 2
unset label 3
unset label 4
unset multiplot
set output
When setting output using set terminal jpeg size 1800,900
, I am getting the following:
But after setting the output using epslatex , I am getting a distorted image as follows:
How do I reconcile the outputs and make the later look like the former?
The resulting ".tex" file from the gnuplot code is as follows:
% GNUPLOT: LaTeX picture with Postscript
\begingroup
\makeatletter
\providecommand\color[2][]{%
\GenericError{(gnuplot) \space\space\space\@spaces}{%
Package color not loaded in conjunction with
terminal option `colourtext'%
}{See the gnuplot documentation for explanation.%
}{Either use 'blacktext' in gnuplot or load the package
color.sty in LaTeX.}%
\renewcommand\color[2][]{}%
}%
\providecommand\includegraphics[2][]{%
\GenericError{(gnuplot) \space\space\space\@spaces}{%
Package graphicx or graphics not loaded%
}{See the gnuplot documentation for explanation.%
}{The gnuplot epslatex terminal needs graphicx.sty or graphics.sty.}%
\renewcommand\includegraphics[2][]{}%
}%
\providecommand\rotatebox[2]{#2}%
\@ifundefined{ifGPcolor}{%
\newif\ifGPcolor
\GPcolorfalse
}{}%
\@ifundefined{ifGPblacktext}{%
\newif\ifGPblacktext
\GPblacktexttrue
}{}%
% define a \g@addto@macro without @ in the name:
\let\gplgaddtomacro\g@addto@macro
% define empty templates for all commands taking text:
\gdef\gplbacktext{}%
\gdef\gplfronttext{}%
\makeatother
\ifGPblacktext
% no textcolor at all
\def\colorrgb#1{}%
\def\colorgray#1{}%
\else
% gray or color?
\ifGPcolor
\def\colorrgb#1{\color[rgb]{#1}}%
\def\colorgray#1{\color[gray]{#1}}%
\expandafter\def\csname LTw\endcsname{\color{white}}%
\expandafter\def\csname LTb\endcsname{\color{black}}%
\expandafter\def\csname LTa\endcsname{\color{black}}%
\expandafter\def\csname LT0\endcsname{\color[rgb]{1,0,0}}%
\expandafter\def\csname LT1\endcsname{\color[rgb]{0,1,0}}%
\expandafter\def\csname LT2\endcsname{\color[rgb]{0,0,1}}%
\expandafter\def\csname LT3\endcsname{\color[rgb]{1,0,1}}%
\expandafter\def\csname LT4\endcsname{\color[rgb]{0,1,1}}%
\expandafter\def\csname LT5\endcsname{\color[rgb]{1,1,0}}%
\expandafter\def\csname LT6\endcsname{\color[rgb]{0,0,0}}%
\expandafter\def\csname LT7\endcsname{\color[rgb]{1,0.3,0}}%
\expandafter\def\csname LT8\endcsname{\color[rgb]{0.5,0.5,0.5}}%
\else
% gray
\def\colorrgb#1{\color{black}}%
\def\colorgray#1{\color[gray]{#1}}%
\expandafter\def\csname LTw\endcsname{\color{white}}%
\expandafter\def\csname LTb\endcsname{\color{black}}%
\expandafter\def\csname LTa\endcsname{\color{black}}%
\expandafter\def\csname LT0\endcsname{\color{black}}%
\expandafter\def\csname LT1\endcsname{\color{black}}%
\expandafter\def\csname LT2\endcsname{\color{black}}%
\expandafter\def\csname LT3\endcsname{\color{black}}%
\expandafter\def\csname LT4\endcsname{\color{black}}%
\expandafter\def\csname LT5\endcsname{\color{black}}%
\expandafter\def\csname LT6\endcsname{\color{black}}%
\expandafter\def\csname LT7\endcsname{\color{black}}%
\expandafter\def\csname LT8\endcsname{\color{black}}%
\fi
\fi
\setlength{\unitlength}{0.0500bp}%
\ifx\gptboxheight\undefined%
\newlength{\gptboxheight}%
\newlength{\gptboxwidth}%
\newsavebox{\gptboxtext}%
\fi%
\setlength{\fboxrule}{0.5pt}%
\setlength{\fboxsep}{1pt}%
\begin{picture}(7200.00,5040.00)%
\gplgaddtomacro\gplbacktext{%
\csname LTb\endcsname%%
\put(588,2520){\makebox(0,0)[r]{\strut{}$0$}}%
\put(588,3863){\makebox(0,0)[r]{\strut{}$100$}}%
\put(720,2300){\makebox(0,0){\strut{} }}%
}%
\gplgaddtomacro\gplfronttext{%
\csname LTb\endcsname%%
\put(1511,4865){\makebox(0,0){\strut{}D1}}%
}%
\gplgaddtomacro\gplbacktext{%
\csname LTb\endcsname%%
\put(588,504){\makebox(0,0)[r]{\strut{}$0$}}%
\put(588,1847){\makebox(0,0)[r]{\strut{}$100$}}%
\put(720,284){\makebox(0,0){\strut{}$0$}}%
}%
\gplgaddtomacro\gplfronttext{%
}%
\gplgaddtomacro\gplbacktext{%
\csname LTb\endcsname%%
\put(2676,2520){\makebox(0,0)[r]{\strut{}$0$}}%
\put(2676,3863){\makebox(0,0)[r]{\strut{}$100$}}%
\put(2808,2300){\makebox(0,0){\strut{} }}%
}%
\gplgaddtomacro\gplfronttext{%
\csname LTb\endcsname%%
\put(3599,4865){\makebox(0,0){\strut{}D2}}%
}%
\gplgaddtomacro\gplbacktext{%
\csname LTb\endcsname%%
\put(2676,504){\makebox(0,0)[r]{\strut{}$0$}}%
\put(2676,1847){\makebox(0,0)[r]{\strut{}$100$}}%
\put(2808,284){\makebox(0,0){\strut{}$0$}}%
}%
\gplgaddtomacro\gplfronttext{%
}%
\gplgaddtomacro\gplbacktext{%
\csname LTb\endcsname%%
\put(4764,2520){\makebox(0,0)[r]{\strut{}$0$}}%
\put(4764,3863){\makebox(0,0)[r]{\strut{}$100$}}%
\put(4896,2300){\makebox(0,0){\strut{} }}%
}%
\gplgaddtomacro\gplfronttext{%
\csname LTb\endcsname%%
\put(5687,4865){\makebox(0,0){\strut{}D3}}%
}%
\gplgaddtomacro\gplbacktext{%
\csname LTb\endcsname%%
\put(4764,504){\makebox(0,0)[r]{\strut{}$0$}}%
\put(4764,1847){\makebox(0,0)[r]{\strut{}$100$}}%
\put(4896,284){\makebox(0,0){\strut{}$0$}}%
\put(3384,202){\makebox(0,0)[l]{\strut{}$x $}}%
\put(360,2167){\rotatebox{90}{\makebox(0,0)[l]{\strut{}$f(x)$}}}%
\put(896,3722){\makebox(0,0)[l]{\strut{}$ (a)\; NK $}}%
\put(872,1874){\makebox(0,0)[l]{\strut{}$ (b) \; NKH \Delta $}}%
}%
\gplgaddtomacro\gplfronttext{%
\csname LTb\endcsname%%
\put(466,4114){\makebox(0,0)[r]{\strut{}$ x^2 $}}%
\csname LTb\endcsname%%
\put(466,3894){\makebox(0,0)[r]{\strut{}$ x^3 $}}%
}%
\gplbacktext
\put(0,0){\includegraphics{test}}%
\gplfronttext
\end{picture}%
\endgroup
And the latex code used to plot it is:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\title{plot}
\author{anon }
\date{February 2022}
\begin{document}
\maketitle
\section{Introduction}
\begin{figure}[h]
\centering
\input{test.tex}
\caption{Caption}
\label{fig:my_label}
\end{figure}
\end{document}
The ".eps" file is available here : test.eps