2

I have plotted 12 nodes in a circle with radius 2 and center (0,0) (I suppose). Now I want to plot it once more in the same figure but with centre (2,0), how could this be achieved? Many thanks for any help!

My current code:

\begin{figure}[h]
    \centering
    \begin{tikzpicture}
    \foreach \a in {1,...,12}
    {
        \node[vertex] (u\a) at ({\a*30}:2){};
    }
    \end{tikzpicture}
    \caption*{\footnotesize{Figure 3}}
\end{figure}

It looks like:

enter image description here

I have tried like ({\a*30}:2)+(2,0) but doesn't work.

  • 2
    Try this: \begin{scope}[xshift=2cm] ... code as before ... \end{scope}. – Pier Paolo Jun 18 '15 at 22:18
  • @Salomo What do you mean? You can draw edges the same way you did the nodes in both foreach statements. – Alenanno Jun 18 '15 at 22:56
  • 2
    Not tested: \usetikzlibrary{calc} and then ($ ({\a*30}:2) + (2,0) $). See also tex.stackexchange.com/questions/31830/… – hpekristiansen Jun 19 '15 at 0:30
  • @Hans-PeterE.Kristiansen Thanks!!! That is a perfect solution! – Salomo Jun 19 '15 at 0:45
2

si j'ai bien compris la question, une solution!

if I understand the question, a solution

\documentclass{article}

\usepackage{tikz}

\usetikzlibrary{shapes,arrows,positioning,decorations.pathreplacing,calc}

\begin{document}

\begin{figure}[h]
    \centering
    \begin{tikzpicture}
    \foreach \aa in{0,5}{
    \begin{scope}[xshift=\aa cm]
    \foreach \a in {1,...,12}
    {
        \node[circle,draw] (u\a) at ({\a*30}:2){};
    }
    \end{scope}
    }
    \end{tikzpicture}
    \caption*{\footnotesize{Figure 3}}
\end{figure}

\end{document}

enter image description here

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.