我编写了以下 LaTeX 代码:
\begin{tikzpicture}
\begin{axis}[
title={Execution Time Using Varying Array Sizes },
xlabel={Array Length},
ylabel={Execution Time [milliseconds]},
xmin=0, xmax=1000000,
ymin=0, ymax=30,
xtick={0,1000,10000,100000,1000000},
ytick={0,5,10,15,20,25,30},
ymajorgrids=true,
grid style=dashed,
]
\addplot[
color=blue,
mark=square,
]
coordinates {
(1000,4.1)(10000,4.2)(100000,6.6)(1000000,26.0)
};
\end{axis}
\end{tikzpicture}
任何有助于解决此问题的帮助都将不胜感激,我已经尝试使用代码进行一些操作,例如切换轴等......
答案1
干得好 ...
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{semilogxaxis}[
title={Execution Time Using Varying Array Sizes },
xlabel={Array Length},
ylabel={Execution Time [milliseconds]},
xmin=0, xmax=1000000,
ymin=0, ymax=30,
xtick={0,1000,10000,100000,1000000},
ytick={0,5,10,15,20,25,30},
ymajorgrids=true,
grid style=dashed,
]
\addplot[color=blue,mark=square] coordinates {
(1000,4.1)(10000,4.2)(100000,6.6)(1000000,26.0)
};
\end{semilogxaxis} % beware the two X letters in semilogxaxis
\end{tikzpicture}
\end{document}