5

I used this previous solution to successfully split a node vertically in my graph.

But by using this solution the graph representation will get mixed up.

How can I fix this?

Thanks in advance!

Example:

\documentclass{minimal}
\usepackage{graphics}
\usepackage{tikz}
\usetikzlibrary{shapes,snakes}
\begin{document}

\begin{tikzpicture}
    %%% Sum (Center)       
    \node[circle split,draw, rotate=90] (left) {\rotatebox{-90}{$\Sigma$} \nodepart{lower} \rotatebox{-90}{$\sigma$}};
    %\node[circle split,draw] (left) {$\Sigma$};

    %%% Output left to sum
    \node[right=5em of left] (empty) {Ausgang};
    \draw[->] (left) to (empty);

    %%% Input 2
    \node[circle, draw,left=5em of left] (2) {$x_2$};
    \path[draw,->] (2) -- node[above] {$w_2$} (left);

    %%% Input 1
    \node[circle, draw,above of=2] (1) {$x_1$};
    \draw[->] (1) to[bend right=-15] node[above] {$w_1$} (left);

    %%% Input bias
    \node[circle, draw,above=1em of 1] (bias) {$Bias$};
    \draw[->] (bias) to[bend right=-25] (left);
    %\draw[->] (bias) to[bend right=-25] node[above] {$w_0$} (left);

    %%% Input 3
    \node[circle, draw,below of=2] (3) {$x_3$};
    \draw[->] (3) to[bend right=15] node[above] {$w_3$} (left);

    %%% Dots
    \node[below of=3] (dots) {$\vdots$};

    %%% Input n
    \node[circle, draw,below of=dots] (n) {$x_n$};
    \draw[->] (n) to[bend right=25] node[above] {$w_n$} (left);

    %%% Input label
    \node[left=1em of 2,font=\scriptsize] {Eingänge};
\end{tikzpicture}

\end{document}

Result: Vertically split circle in graph resulting in a messed up representation

Wanted: (Change comments in the %%% Sum (Center) section) Wanted result missing a vertically split graph

Robert
  • 125
  • It would not be appropriate to use $Ausgang$ but \mathit{...} in mathematical mode or \textit{...} in textual mode. – Sebastiano Jul 23 '18 at 07:55
  • You are correct. I will fix this. Do you also have any suggestions on my stated problem? – Robert Jul 23 '18 at 07:58
  • With a lot of sincerity I am not as good as many other users. Surely someone will give you the answer you're looking for. There are a lot of good people here. – Sebastiano Jul 23 '18 at 08:01

2 Answers2

6

When you rotate a node, the anchors are also rotated, so the east anchor ends up on the top of the node when you have rotate=90. When you do right=of left in the options to empty, the positioning library uses the east anchor of left as a reference, and because this is now at the top of the node, things are skewed.

Use right=5em of left.south and left=5em of left.north for the two nodes placed relatively to left, to force the use of the correct reference points.

Also: don't use the minimal class. For example, it doesn't define the font switching commands like \scriptsize, your example (after adding the missing positioning library) throws an error for font=\scriptsize. (See Why should the minimal class be avoided?)

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning}
\begin{document}

\begin{tikzpicture}
    %%% Sum (Center)       
    \node[circle split,draw, rotate=90] (left) {\rotatebox{-90}{$\Sigma$} \nodepart{lower} \rotatebox{-90}{$\sigma$}};
    %\node[circle split,draw] (left) {$\Sigma$};

    %%% Output left to sum
    \node[right=5em of left.south] (empty) {Ausgang};
    \draw[->] (left) to (empty);

    %%% Input 2
    \node[circle, draw,left=5em of left.north] (2) {$x_2$};
    \path[draw,->] (2) -- node[above] {$w_2$} (left);

    %%% Input 1
    \node[circle, draw,above of=2] (1) {$x_1$};
    \draw[->] (1) to[bend right=-15] node[above] {$w_1$} (left);

    %%% Input bias
    \node[circle, draw,above=1em of 1] (bias) {Bias};
    \draw[->] (bias) to[bend right=-25] (left);
    %\draw[->] (bias) to[bend right=-25] node[above] {$w_0$} (left);

    %%% Input 3
    \node[circle, draw,below of=2] (3) {$x_3$};
    \draw[->] (3) to[bend right=15] node[above] {$w_3$} (left);

    %%% Dots
    \node[below of=3] (dots) {$\vdots$};

    %%% Input n
    \node[circle, draw,below of=dots] (n) {$x_n$};
    \draw[->] (n) to[bend right=25] node[above] {$w_n$} (left);

    %%% Input label
    \node[left=1em of 2,font=\scriptsize] {Eingänge};
\end{tikzpicture}

\end{document}
Torbjørn T.
  • 206,688
  • 1
    Also changed $Bias$ to Bias. – Torbjørn T. Jul 23 '18 at 08:11
  • Thank you very much for your fast and helpful answer with a detailed explanation of the problem cause! I used the minimal document class only for the example on stackoverflow and using a different class for my current work. – Robert Jul 23 '18 at 08:18
2

a way how i would wrote code for your image: for positioning of nodes is used tikz libraries chains and for wights of edges quotes:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{chains, positioning, quotes, shapes.multipart}

\begin{document}
    \begin{tikzpicture}[
  node distance = 4mm and 20mm,
    start chain = A going below,
    circ/.style = {circle, draw, minimum size=2em, inner sep=1pt,
                   font=\small, on chain=A},
   every edge quotes/.append style = {inner sep=2pt, pos=0.4}
                        ]
\node[circ]     {Bias};         % name: A-1
\node[circ]     {$w_1$};        % name: A-2
\node[circ,label=left:Eingänge] {$w_2$};
\node[circ]     {$w_3$};
\coordinate[on chain] (aux1);
\node[circ] (n) {$w_n$};        % name: A-6
%%%% sum
\node[circle split, draw, right=of A-3,
      rotate=90,anchor=center] (sum) {\rotatebox{-90}{$\Sigma$} \nodepart{lower} \rotatebox{-90}{$\sigma$}};
%%% Output left to sum
\node[right=5em of sum.center] (out) {Ausgang};
\draw[->]   (A-1) edge [bend left] (sum)
            (A-2) edge [bend left, "$w_1$"] (sum)
            (A-3) edge ["$w_2$"]            (sum)
            (A-4) edge [bend right,"$w_3$"] (sum)
            (A-6) edge [bend right,"$w_n$"] (sum);
\draw[very thick, loosely dotted, shorten >=6pt, shorten <=6pt] (A-4) -- (A-6);
\draw[->] (sum) -- (out);
    \end{tikzpicture}
\end{document}

enter image description here

Zarko
  • 296,517