Snippets

Torbjørn Taskjelle Scopes and node distance

Created by Torbjørn Taskjelle last modified
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
    [%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     node distance=0.6cm,
        place/.style={circle,draw=blue!50,fill=blue!20,thick,
                      inner sep=0pt,minimum size=6mm}
    ]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \draw[step=1cm,cyan,very thin] (-5, 5) grid (4,-4);
    \node[place] (L) at (-4,4) {L};
    \begin{scope}[node distance=6cm]
    \node[place] (N) [right=of L]  {N};
    \node[place] (O) [below=of L]  {O};
    \node[place] (I) [below=of N]  {I};
    \end{scope}
    \node[place] (F)  at (barycentric cs:L=0.1,O=0.1)  {F};
    \node[place] (G)  at (barycentric cs:N=0.1,I=0.1)  {G};

    \node[place] (K) [right=of F] {K};
    \node[place] (D) [above=of F] at (barycentric cs:F=0.1,K=0.1)  {D};
    \node[place] (M) [below=of F] at (barycentric cs:F=0.1,K=0.1)  {M};

    \node[place] (J) [left=of G] {J};
    \node[place] (A) [above=of G] at (barycentric cs:G=0.1,J=0.1)  {A};
    \node[place] (P) [below=of G] at (barycentric cs:G=0.1,J=0.1)  {P};

    \begin{scope}[node distance=1.2cm]
    \node[place] (E) [right=of D] {E};
    \node[place] (C) [left=of  A] {C};
    \node[place] (B) [right=of M] {B};
    \node[place] (H) [left=of  P] {H};
    \end{scope}

    \draw[thick] (L) -- (N) -- (G) -- (I) -- (O) -- (F) -- (L)
                     -- (C) -- (J) -- (P) -- (G) -- (A) -- (J) -- (H) -- (O);
    \draw[thick] (N) -- (E) -- (K) -- (M) -- (F) -- (F) -- (D) -- (K) -- (B) -- (I);
    \draw[thick] (E) -- (C);
    \draw[thick] (B) -- (H);

\end{tikzpicture}
\end{document}

Comments (0)