2

Inspired by this question and an answer by @Schrödinger's cat, how to draw a table of clocks on a plane in an effective way?

  • 3
    I'm voting to close this question as this is too broad and -1 for making it ajust-do-it-for-me question. And, if you find the answers to your past questions useful, consider accepting then before asking a new one. – Raaja Sep 22 at 10:25
  • 3
    Your question leaves all the effort to our community, even typing the essentials of a TeX document such as \documentclass{}...\begin{document} etc. As it is, most of our users will be very reluctant to touch your question, and you are left to the mercy of our procrastination team who are very few in number and very picky about selecting questions. You can improve your question by adding a minimal working example (MWE) that more users can copy/paste onto their systems to work on. If no hero takes the challenge we might have to close your question. – BambOo Sep 22 at 10:54
  • 1
    While you're working on an MWE, maybe this answer can get you started with the plane. You'll just have to add the clocks. – schtandard Sep 22 at 14:01
10

This is just a nested loop.

\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}
 \foreach \X in {1,...,5}
 {\foreach \Y in {1,2,3}
 {\draw (\X,\Y) circle[radius=4mm]
 (\X,\Y) -- ++(180-45*\X:0.4);
 }}
\end{tikzpicture}
\end{document}

enter image description here

But one can do better using some existing post.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot} 
\usetikzlibrary{3d,decorations.markings}
\tikzset{Annie/.cd,
hour/.initial=0,
hour arm/.style={thick,shorten >=1mm,red},
clock/.style={semithick,fill=white},
clock radius/.initial=5mm}
\begin{document}
\tdplotsetmaincoords{60}{20} 
\begin{tikzpicture}[tdplot_main_coords,pics/clock/.style={code={
\tikzset{Annie/.cd,#1}
\draw[Annie/clock] (0,0) 
circle[radius=\pgfkeysvalueof{/tikz/Annie/clock radius}];
\draw[Annie/hour arm] (0,0) --
(90-30*\pgfkeysvalueof{/tikz/Annie/hour}:\pgfkeysvalueof{/tikz/Annie/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{clock={hour=\X*3/2}}}};
\end{scope} 
\end{tikzpicture}
\end{document}

enter image description here

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot} 
\usetikzlibrary{3d,decorations.markings}
\tikzset{Annie/.cd,
hour/.initial=0,
hour arm/.style={thick,shorten >=1mm,red},
clock/.style={semithick,fill=white},
clock radius/.initial=5mm}
\begin{document}
\tdplotsetmaincoords{60}{00} 
\begin{tikzpicture}[tdplot_main_coords,pics/clock/.style={code={
\tikzset{Annie/.cd,#1}
\draw[Annie/clock] (0,0) 
circle[radius=\pgfkeysvalueof{/tikz/Annie/clock radius}];
\draw[Annie/hour arm] (0,0) --
(90-30*\pgfkeysvalueof{/tikz/Annie/hour}:\pgfkeysvalueof{/tikz/Annie/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] (6,4);
 \path foreach \X in {-2,...,3} 
  {foreach \Y in {-1,...,2} 
  { (\X*pi/2,\Y*pi/2) pic{clock={hour=\X*3/2}}}};
\end{scope} 
\end{tikzpicture}
\end{document}

enter image description here

  • Nice for the last figure. how do we remove the blue rulers or rails? – annie heart Sep 22 at 2:31
  • @annieheart I changed it. (Had to change a couple of pgf keys.) If you want an "untitled" view, use e.g. \tdplotsetmaincoords{60}{0}. – Schrödinger's cat Sep 22 at 2:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.