我对这一切都很陌生。我打算制作一些弯曲的刻度。我希望刻度线和相应的数字竖立起来垂直地给定一个二维曲线,例如一个圆 - 想象一下钟面。我该怎么做?
答案1
我今天没做什么正经事!
\documentclass[dvipsnames,x11names]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\filldraw [fill=Goldenrod!30] (2,0)arc[radius=2cm,start angle=0,end angle=180] -- (-2,0) -- cycle;
\fill[IndianRed3] (0.1,0)arc[radius=0.1cm,start angle=0,end angle=180] -- (-0.1,0) -- cycle;
\foreach \angle/\label in {10/1,20/2,30/3,40/4,50/5,60/6,70/7,80/8,90/9,100/10,110/11,120/12,130/13,140/14,150/15,160/16,170/17}{
\draw (\angle:1.8cm) -- (\angle:2cm);
\path (\angle:1.7cm) -- node[rotate=\angle-90,pos=0.02,font=\tiny]{\textsf{\label}}(\angle:2cm);
}
\foreach \angle in {1,2,...,179}{
\draw[thin] (\angle:1.9cm) -- (\angle:2cm);
}
\draw[IndianRed3, thick] (0,0) -- (68:1.6cm);
\end{tikzpicture}
\end{document}
答案2
根据路径,您可以使用sloped
选项将节点垂直于路径。例如
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[allow upside down]
\draw (0,2) arc (90:-270:2) node foreach \p in {1,...,12} [pos=\p/12,below,sloped] {\p};
\draw (0,2) arc (90:-270:2) node foreach \p in {1,...,12} [pos=\p/12,sloped] {\tikz\draw (0,0)--(0,1ex);};
\end{tikzpicture}
\end{document}
生产