例如,从这个问题的答案 Torbjørn T. 开始使用 TikZ 绘制这样的网格,
\documentclass[tikz,border=4mm]{standalone}
\begin{document}
\begin{tikzpicture}[>=stealth]
% draw axis lines
\draw [->] (-0.5,0) -- (5,0) node[below]{$n$};
\draw [->] (0,-0.5) -- (0,3) node[left]{$k$};
% place bullets
\foreach \x in {0,1,2,3}
\foreach \y in {0,0.2,...,2}
\fill (\x,\y) circle[radius=2pt];
% place ticklabels below x-axis
\foreach \x/\txt in {1/L,2/2L,3/3L}
\node [below] at (\x,0) {$\txt$};
% place ticklabel for y-axis
\node [left] at (0,2) {$N-1$};
% place 2pi/n-node left of axis
\node [left=1.4cm,inner xsep=0pt] (A) at (0,1) {$\frac{2\pi}{n}$};
% dots on the far right
\node at (4,1) {$\dots$};
% draw lines from fourth and fifth bullet to a coordinate relative to the 2pi/n node
% (vertical separation of bullets is 0.2)
\draw (0, 4*0.2) to[out=180,in=0] ([yshift=-0.5cm,xshift=2pt]A.south west);
\draw (0, 5*0.2) to[out=180,in=0] ([yshift=0.5cm,xshift=2pt]A.north west);
% draw arrows
\draw [->] (A.north) -- ++(0,0.5cm);
\draw [->] (A.south) -- ++(0,-0.5cm);
\end{tikzpicture}
\end{document}
我想了解如何绘制此垂直杆(刻度尺)第一张图片
其中,敲响一般时间的时钟(带有奇怪数字的矩形)将被替换为如图所示的圆形时钟。第二张图片
通过这种方式,我可以改变时钟和刺血针的背景颜色。
答案1
像这样吗?这是 3d。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d,decorations.markings}
\tikzset{Sebastiano/.is family,
Sebastiano/.cd,
minute arm/.style={shorten >=0.5mm},
hour arm/.style={thick,shorten >=1.5mm},
random clock/.style={semithick,fill=white},
clock radius/.initial=5mm}
\begin{document}
\tdplotsetmaincoords{60}{20}
\begin{tikzpicture}[tdplot_main_coords,pics/random clock/.style={code={
\tikzset{Sebastiano/.cd,#1}
\pgfmathsetmacro{\mytime}{rnd*720}
\pgfmathsetmacro{\minute}{mod(\mytime,60)}
\pgfmathsetmacro{\hour}{\mytime/5}
\draw[Sebastiano/random clock] (0,0)
circle[radius=\pgfkeysvalueof{/tikz/Sebastiano/clock radius}];
\draw[Sebastiano/hour arm] (0,0) -- (\hour:\pgfkeysvalueof{/tikz/Sebastiano/clock radius});
\draw[Sebastiano/minute arm] (0,0) -- (\minute:\pgfkeysvalueof{/tikz/Sebastiano/clock radius});
}},ruler/.style={postaction={decorate,decoration={markings,
mark=between positions 0 and 1 step 5pt with {\draw (0,-#1/2) -- (0,#1/2);}}}}]
\begin{scope}[canvas is xz plane at y=0,transform shape]
\draw[double=cyan,double distance=4pt,ruler=4pt] (-4,-2.4) grid[step=pi/2] (4,4);
\path foreach \X in {-2,...,2}
{foreach \Y in {-1,...,2}
{ (\X*pi/2,\Y*pi/2) pic{random clock={minute arm/.append style={red},
hour arm/.append style={blue}}}}};
\end{scope}
\end{tikzpicture}
\end{document}
如果你不想要3d,只需设置\tdplotsetmaincoords{90}{00}
为获取
我希望语法
pic{random clock={minute arm/.append style={red},
hour arm/.append style={blue}}
是不言自明的。如果你想找一个画“数学家轴”的人,那么我不是你的人选。我解释说这里,为什么。我很乐意在正交投影中添加轴,但讨论的内容这里我认为现代教科书里没有这个位置。在黑板上这个还是可以的。