2

I used pgfplots package to draw two standalone plots. I want these two plots with the same height but I failed.

Here is the image shown in my paper. image shown in  paper As you see, the right one is a little higher than the left one.

I've tried these things:

  1. Use scaled x ticks=false. This problem can be solved by this method. However, the number is too close, which is what I wouldn't like. I suspect it's caused by the exponent. So I tried 2. next.

  2. move the exponent to some other places by

    every x tick scale label/.style={ at={(rel axis cs:0.9,-0.2)} }

    However, this problem can not be solved. They are still not the same high.

The code of the left plot:

\usepackage{pgfplots, pgfplotstable}
\pgfplotsset{compat=1.16}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathpazo}

\begin{document} \pgfplotstableread[col sep=&, header=true]{ noise level &rmse &mean error 0 &13.8735 &5.4890 0.001 &14.8757 &5.6138 0.002 &16.6551 &5.8121 0.003 &18.1159 &6.0338 0.004 &20.0011 &6.2824 0.005 &21.9840 &6.5650 0.006 &23.8113 &6.8693 0.007 &25.8505 &7.1813 0.008 &27.4285 &7.5026 0.009 &29.4434 &7.8572 0.01 &31.1316 &8.2160 }\datatableentry

\begin{tikzpicture} \begin{axis}[ major grid style={line width=.5pt,draw=gray!50}, title={\quad}, xtick ={0.000,0.002,...,0.010}, minor xtick ={0.001,0.003,...,0.01}, ymajorgrids, % yminorgrids, xtick pos=left, ytick pos=left, scaled x ticks=true, ymin=0, xmin=0, xmax=0.01, ymax=40, legend style={legend pos= north west, legend cell align=left}, mark size=2, xlabel={$p$}, ylabel={Value (m)}, tick scale binop=\times, semithick, height=5cm, mark repeat={2}, every x tick scale label/.style={ at={(rel axis cs:0.9,-0.2)},overlay }, ] % red,gray,yellow,green,lime,black,red,blude,cyan \addlegendentry{RMSE}; \addplot [color=orange,thick,mark=o] table [y=rmse, x=noise level] {\datatableentry}; \addlegendentry{mean error}; \addplot [color=cyan,thick,mark=diamond] table [y=mean error, x=noise level] {\datatableentry}; \end{axis} \end{tikzpicture} \end{document}

The code of the right plot

\documentclass{standalone}
\usepackage{pgfplots, pgfplotstable}
\pgfplotsset{compat=1.16}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathpazo}

\begin{document} \pgfplotstableread[col sep=&, header=true]{ noise level &rmse &mean error 0 &13.8735 &5.4890 0.2 &13.8491 &5.4878 0.4 &14.1604 &5.5624 0.6 &14.2584 &5.6174 0.8 &14.5146 &5.7072 1.0 &15.0029 &5.8409 1.2 &14.9655 &5.9318 1.4 &15.2164 &6.0813 1.6 &15.5703 &6.2642 1.8 &15.9604 &6.4683 2.0 &16.4144 &6.7071 2.2 &16.8802 &6.9842 2.4 &17.6332 &7.3055 2.6 &18.2558 &7.6403 2.8 &19.1625 &8.0250 3.0 &19.9934 &8.4352 }\datatableentry

\begin{tikzpicture} \begin{axis}[ %grid style={line width=.1pt, draw=gray!20}, major grid style={line width=.5pt,draw=gray!50}, title={\quad}, % minor y tick num=4, % xtick=data, xtick ={0,1,...,3}, minor xtick={0.2,0.4,...,3}, ymajorgrids, % yminorgrids, xtick pos=left, ytick pos=left, scaled y ticks=true, ymin=0, xmin=0, xmax=3, ymax=25, ytick={0,5,...,25}, legend style={legend pos= north west,legend cell align=left}, mark size=2, xlabel={$\sigma_n$(degrees)}, ylabel={Value (m)}, tick scale binop=\times, height=5cm, semithick, mark repeat={2}, scaled x ticks={base 10:0} ] % red,gray,yellow,green,lime,black,red,blude,cyan \addlegendentry{RMSE}; \addplot [color=orange,thick,mark=o] table [y=rmse, x=noise level] {\datatableentry}; \addlegendentry{mean error}; \addplot [color=cyan,thick,mark=diamond] table [y=mean error, x=noise level] {\datatableentry}; \end{axis} \end{tikzpicture} \end{document}

They are inserted into the paper like this:

\begin{figure}[htb]
  \centering
  \subfloat[Performance  under different levels of increment noise]{\includegraphics[height=4cm]{incremental_noise/incremental_noise}}
\hspace{.5cm}
  \subfloat[Performance  under different levels of deviation noise]{\includegraphics[height=4cm]{deviation_noise/deviation_noise}}
  \caption{Resistence to different kind of noise.}
  \label{fig:noise_resistence}
\end{figure}

Do you have any idea about solving this problem? Thanks!

1 Answers1

1

I've known what to do to solve the problem. I add \raisebox{-0.25ex}[0pt][0pt] in my main tex file and the result looks fine. See this answer for more details.