答案1
绘制这个图形有很多种可能性,这里是其中一种。
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,0) -- (14,0);
\foreach \X in {0,...,13}
{\draw (\X,0.1) -- (\X,-0.1);}
\foreach \X in {0,4,10,12}
{\node[anchor=north] at (\X,-0.1){\X};}
\end{tikzpicture}
\end{document}
可以让你添加以逗号作为小数分隔符的数字的是
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,0) -- (14,0);
\foreach \X in {0,...,13}
{\draw (\X,0.1) -- (\X,-0.1);}
\foreach \X in {0,2.6,4,6.7,10,12}
{\draw (\X,0.1) -- (\X,-0.1)
node[below] {\pgfmathprintnumber[use comma]{\X}};}
\end{tikzpicture}
\end{document}
如果你想要更密集的滴答声,请尝试例如
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,0) -- (14,0);
\foreach \X [evaluate=\X as \Y using {int(10*(\X-int(\X)))}] in {0,0.1,...,13}
{\ifnum\Y=0
\draw (\X,0.15) -- (\X,-0.15);
\else
\draw (\X,0.1) -- (\X,-0.1);
\fi}
\foreach[evaluate=\X as \Y using {int(10*(\X-int(\X)))}] \X in {0,2.6,4,6.7,10,12}
{\ifnum\Y=0
\node[anchor=north] at (\X,-0.15){\pgfmathprintnumber[use comma]{\X}};
\else
\node[anchor=north] at (\X,-0.1){\pgfmathprintnumber[use comma]{\X}};
\fi
}
\end{tikzpicture}
\end{document}
当然,也可以在射线上方添加非整数值的刻度。
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,0) -- (14,0);
\foreach \X [evaluate=\X as \Y using {int(10*(\X-int(\X)))}] in {0,0.1,...,13}
{\ifnum\Y=0
\draw (\X,0.15) -- (\X,-0.15);
\else
\draw (\X,0.1) -- (\X,-0.1);
\fi}
\foreach[evaluate=\X as \Y using {int(10*(\X-int(\X)))}] \X in {0,2.6,4,6.7,10,12}
{\ifnum\Y=0
\node[anchor=north] at (\X,-0.15){\pgfmathprintnumber[use comma]{\X}};
\else
\node[anchor=south] at (\X,0.1){\pgfmathprintnumber[use comma]{\X}};
\fi
}
\end{tikzpicture}
\end{document}