代码:
\begin{document}
\usepackage{tikz}
\begin{figure}
\begin{center}
\begin{tikzpicture}[scale=1.2]
\begin{axis}[
title=Oxford CROW features Parallel Search,
xlabel=$Threads$,
ylabel=$Time$ (sec),
legend pos=north east]
\addplot coordinates {
(1, 3.18099e-05)
(2, 3.02396e-05)
(4, 1.05439e-05)
};
\addplot [red,mark=triangle] coordinates {
(1, 0.000515463)
(2, 0.000272568)
(4, 0.000166557)
};
\addplot [green,mark=square] coordinates {
(1, 0.000517588)
(2, 0.000410064)
(4, 0.000166227)
};
\addlegendentry{$threshold = N * 1\%$}
\addlegendentry{$threshold = N * 5\%$}
\addlegendentry{$threshold = N * 10\%$}
\end{axis}
\end{tikzpicture}
\end{center}
\caption{Oxford CROW features, $N$ = 5063, $D$ = 512, Parallel Search.}
\label{crowParSearch}
\end{figure}
\end{document}
输出(注意标题如何与该数字重叠):
关于如何让这种重叠消失,您有什么想法吗?
答案1
使用该
width
选项可使图例更宽。这也为图例提供了更多空间,使其不会与图例重叠。添加
\pgfplotsset{compat=1.14}
(或无论您使用哪个版本,请参阅日志文件中的注释)以使 y 轴的标签移动得更近。
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\begin{document}
\begin{figure}
\begin{center}
\begin{tikzpicture}
\begin{axis}[
width=10cm,
title=Oxford CROW features Parallel Search,
xlabel=$Threads$,
ylabel=$Time$ (sec),
legend pos=north east]
\addplot coordinates {
(1, 3.18099e-05)
(2, 3.02396e-05)
(4, 1.05439e-05)
};
\addplot [red,mark=triangle] coordinates {
(1, 0.000515463)
(2, 0.000272568)
(4, 0.000166557)
};
\addplot [green,mark=square] coordinates {
(1, 0.000517588)
(2, 0.000410064)
(4, 0.000166227)
};
\addlegendentry{$threshold = N * 1\%$}
\addlegendentry{$threshold = N * 5\%$}
\addlegendentry{$threshold = N * 10\%$}
\end{axis}
\end{tikzpicture}
\end{center}
\caption{Oxford CROW features, $N$ = 5063, $D$ = 512, Parallel Search.}
\label{crowParSearch}
\end{figure}
\end{document}