2

I would like to ask how I could move up the separation line (a4) edge [line width=7pt] (a10) in this picture:

\documentclass[border=1mm,tikz]{standalone}
\usetikzlibrary{arrows,automata,shapes.multipart,calc,decorations.text}
\begin{document}

    \begin{tikzpicture}[-,>=stealth',shorten >=1pt,auto,node distance=4cm,semithick,
        every text node part/.style={align=center},
        %,inner sep=0pt
        %,scale=0.5
        ]
      % \tikzstyle{every state}=[fill=blue!25,text=black,draw=none]

      \node[](a1)   {};
      \node[state,minimum size=1cm](a2) [right of=a1] {\Large$3$};
      \node[](a3) [right of=a2] {};
      \node[](a4) [above of=a2] {};
      \node[](a5) [above of=a4] {};
      \node[](a10) [above of=a5] {};
      \node[state,minimum size=1cm](a6) [left of=a5] {\Large$2$};
      \node[state,minimum size=1cm](a7) [above of=a6] {\Large$1$};
      %
      \node[state,minimum size=1cm](a8) [right of=a5] {\Large$4$};
      \node[state,minimum size=1cm](a9) [above of=a8] {\Large$5$};


    \begin{scope}[every node/.style={scale=1.5}] 
        \path (a7)  edge [sloped, anchor=center,above] node {31.6 m} (a2)
              (a6)  edge [sloped, anchor=center,above] node {22.36 m} (a2)
              (a8)  edge [sloped, anchor=center,above] node {22.36 m} (a2)
              (a9)  edge [sloped, anchor=center,above] node {31.6 m} (a2)
              (a6)  edge [sloped, anchor=center,above] node {10 m} (a7)
              (a8)  edge [sloped, anchor=center,above] node {10 m} (a9)
              (a4)  edge [line width=7pt] (a10)
              ;


    \end{scope}
    \end{tikzpicture}

\end{document}

enter image description here

without changing the relative positions of the nodes. The line (a4) edge [line width=7pt] (a10) represents a wireless signal barrier between the pairs' nodes labeled 1, 2 and 4, 5.

I would like to set the yshift of nodes a4 and a10, not chaging the positions of the rest of nodes.

Regards

0

1 Answer 1

1

Just from looking at your picture I suspect you want to have something like (a6.south-|a2) edge [line width=7pt] (a7.north-|a2).

\documentclass[border=1mm,tikz]{standalone}
\usetikzlibrary{arrows,automata}
\begin{document}

    \begin{tikzpicture}[-,>=stealth',shorten >=1pt,auto,node distance=4cm,semithick,
        every text node part/.style={align=center},
        ]

      \node[](a1)   {};
      \node[state,minimum size=1cm](a2) [right of=a1] {\Large$3$};
      \node[](a3) [right of=a2] {};
      \node[](a4) [above of=a2] {};
      \node[](a5) [above of=a4] {};
      \node[](a10) [above of=a5] {};
      \node[state,minimum size=1cm](a6) [left of=a5] {\Large$2$};
      \node[state,minimum size=1cm](a7) [above of=a6] {\Large$1$};
      %
      \node[state,minimum size=1cm](a8) [right of=a5] {\Large$4$};
      \node[state,minimum size=1cm](a9) [above of=a8] {\Large$5$};


    \begin{scope}[every node/.style={scale=1.5}] 
        \path (a7)  edge [sloped, anchor=center,above] node {31.6 m} (a2)
              (a6)  edge [sloped, anchor=center,above] node {22.36 m} (a2)
              (a8)  edge [sloped, anchor=center,above] node {22.36 m} (a2)
              (a9)  edge [sloped, anchor=center,above] node {31.6 m} (a2)
              (a6)  edge [sloped, anchor=center,above] node {10 m} (a7)
              (a8)  edge [sloped, anchor=center,above] node {10 m} (a9)
              (a6.south-|a2)  edge [line width=7pt] (a7.north-|a2)
              ;


    \end{scope}
    \end{tikzpicture}

\end{document}

enter image description here

Of course, you can further adjust it, e.g. ([yshift=-5mm]a6.south-|a2) edge [line width=7pt] (a7.north-|a2) yields

enter image description here

Note that not all the nodes you define are necessary here. And I would recommend using positioning and to name the nodes according to their contents, which leads us to:

\documentclass[border=1mm,tikz]{standalone}
\usetikzlibrary{arrows,automata,positioning}
\begin{document}

    \begin{tikzpicture}[-,>=stealth',shorten >=1pt,auto,
    node distance=3.5cm and 3.5cm,semithick,
        every text node part/.style={align=center},
        ]

      \node[state,minimum size=1cm](a3){\Large$3$};
      \node[state,minimum size=1cm](a2) [above left=7cm and 3.5cm of a3] {\Large$2$};
      \node[state,minimum size=1cm](a1) [above=of a2] {\Large$1$};
      %
      \node[state,minimum size=1cm](a4) [above right=7cm and 3.5cm of a3] {\Large$4$};
      \node[state,minimum size=1cm](a5) [above=of a4] {\Large$15$};


    \begin{scope}[every node/.style={scale=1.5}] 
        \path (a1)  edge [sloped, anchor=center,above] node {31.6 m} (a3)
              (a2)  edge [sloped, anchor=center,above] node {22.36 m} (a3)
              (a4)  edge [sloped, anchor=center,above] node {22.36 m} (a3)
              (a5)  edge [sloped, anchor=center,above] node {31.6 m} (a3)
              (a2)  edge [sloped, anchor=center,above] node {10 m} (a1)
              (a4)  edge [sloped, anchor=center,above] node {10 m} (a5)
              ([yshift=-5mm]a2.south-|a3)  edge [line width=7pt] (a1.north-|a3)
              ;


    \end{scope}
    \end{tikzpicture}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .