![如何使轴的值在 pgf 图中清晰显示?](https://linux22.com/image/428924/%E5%A6%82%E4%BD%95%E4%BD%BF%E8%BD%B4%E7%9A%84%E5%80%BC%E5%9C%A8%20pgf%20%E5%9B%BE%E4%B8%AD%E6%B8%85%E6%99%B0%E6%98%BE%E7%A4%BA%EF%BC%9F.png)
我编写了以下 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}