Ich habe versucht, mein zweites Tikz-Modell zu erstellen, basierend aufTikZ: Diagramm eines Perzeptrons. Ich habe es geschafft, es auf der Grundlage meiner Anfängerkenntnisse und Experimente zu modifizieren, aber der Teil, der mir fehlt, und ich kann nicht herausfinden, wie ich die Kugeln machen soll. Ich versuche, den Abstand zu verringern, aber das hat keine Auswirkung. Ich habe es versucht, distance node = 1 em
aber im Moment nicht erfolgreich. Gibt es eine mögliche Lösung für mein Problem? Ein Beispiel der Ausgabe wird bereitgestellt. Alle Vorschläge sind willkommen.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,calc} % braces {}
\usetikzlibrary{shapes,arrows,positioning}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\begin{document}
\tikzset{
block/.style={
draw,
rectangle,
minimum height=2em,
minimum width=5em,
},
sum/.style={
draw,
circle,
minimum size=2em
},
input/.style={coordinate},
output/.style={coordinate},
mytext/.style={
draw,
text depth=4pt,
text height=10pt
}
}
\begin{figure}[!ht]
\begin{center}
\makebox[\textwidth][c]{%
\begin{tikzpicture}[auto,>=latex']
% Blocks
\node[input, name = input] {};
\node[sum, right = of input, node distance = 1em] (sum) {MP};
\node[block, right of = sum, node distance = 6.5em] (stream) {Stream $2$};
\node[sum, right = of stream, node distance = 1em] (filter) {$F_2$};
\node[sum, above = of sum, node distance = 5em] (sum_2) {MP};
\node[block, right of = sum_2, node distance = 6.5em] (stream_2) {Stream$1$};
\node[sum, right = of stream_2, node distance = 1em] (filter_2) {$F_1$};
% Bullets
\node[below of = sum, node distance = 3em] (dot) {$\bullet$} -- (dot);
\node[below of = dot, node distance = 1em] (dot_2) {$\bullet$} -- (dot_2);
\node[below of = dot_2, node distance = 1em] (dot_3) {$\bullet$} -- (dot_3);
\node[below of = stream, node distance = 3em] (dot_4) {$\bullet$} -- (dot_4);
\node[below of = dot_4, node distance = 1em] (dot_5) {$\bullet$} -- (dot_5);
\node[below of = dot_5, node distance = 1em] (dot_6) {$\bullet$} -- (dot_6);
\node[below of = filter, node distance = 3em] (dot_7) {$\bullet$} -- (dot_7);
\node[below of = dot_7, node distance = 1em] (dot_8) {$\bullet$} -- (dot_8);
\node[below of = dot_8, node distance = 1em] (dot_9) {$\bullet$} -- (dot_9);
% Blocks
\node[input, name = input_n] {};
\node[sum, below = of dot_3, node distance = 1em] (sum_n) {MP};
\node[block, right of = sum_n, node distance = 6.5em] (stream_n) {Stream $n$};
\node[sum, right = of stream_n, node distance = 1em] (filter_n) {$F_n$};
% Sum
\node[sum, right = of filter, node distance = 3em] (total) {$\sum$};
% Oneway delay
\node[block, right of = total, node distance = 7.5em] (delay) {One Way Delay};
\node[block, right of = delay, node distance = 15em] (segments) {$MP_1$ $|$ $Payload_1$ $\dots$ $MP_n$ $|$ $Payload_n$};
\node[output,right = of segments] (output) {};
% Inputs
\node[input,left = of sum_2] (output_2) {};
\node[input,left = of sum_n] (output_n) {};
% Lines Center Block
\draw[->] (input) -- node [name = begging] {$IN_2$} (sum);
\draw[->] (sum) -- node {} (stream);
\draw[->] (stream) -- node {} (filter);
\draw[->] (filter) -- node {} (total);
\draw[->] (total) -- node {} (delay);
\draw[->] (delay) -- node {} (segments);
\draw[->] (segments) -- node {Data} (output);
% Lines Above Center Block
\draw[->] (sum_2) -- node {} (stream_2);
\draw[->] (stream_2) -- node {} (filter_2);
\draw[->] (filter_2) -- node {} (total);
% Lines Below Center Block
\draw[->] (sum_n) -- node {} (stream_n);
\draw[->] (stream_n) -- node {} (filter_n);
\draw[->] (filter_n) -- node {} (total);
% Input Lines
\draw[->] (output_2) -- node {$IN_1$} (sum_2);
\draw[->] (output_n) -- node {$IN_n$} (sum_n);
\end{tikzpicture} }% End of makebox
\caption{New Tikz}
\label{fig:tikz }
\end{center}
\end{figure}
\end{document}
Antwort1
Ich würde Ihnen einen anderen Ansatz vorschlagen, bei dem ein gleichmäßiger Abstand zwischen den Ebenen gewährleistet ist:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,calc} % braces {}
\usetikzlibrary{shapes,arrows,positioning}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\begin{document}
\tikzset{
block/.style={
draw,
rectangle,
minimum height=2em,
minimum width=5em,
},
sum/.style={
draw,
circle,
minimum size=2em
},
input/.style={coordinate},
output/.style={coordinate},
mytext/.style={
draw,
text depth=4pt,
text height=10pt
}
}
\begin{figure}[!ht]
\begin{center}
\makebox[\textwidth][c]{%
\begin{tikzpicture}[auto,>=latex']
% Blocks
\node[input, name = input] {};
\node[sum, right = of input, node distance = 1em] (sum) {MP};
\node[block, right of = sum, node distance = 6.5em] (stream) {Stream $2$};
\node[sum, right = of stream, node distance = 1em] (filter) {$F_2$};
\node[sum, above = of sum, node distance = 5em] (sum_2) {MP};
\node[block, right of = sum_2, node distance = 6.5em] (stream_2) {Stream$1$};
\node[sum, right = of stream_2, node distance = 1em] (filter_2) {$F_1$};
% Blocks
\node[input, name = input_n] {};
\node[sum, below = of sum, node distance = 1em] (sum_n) {MP};
\node[block, right of = sum_n, node distance = 6.5em] (stream_n) {Stream $n$};
\node[sum, right = of stream_n, node distance = 1em] (filter_n) {$F_n$};
% Bullets
\foreach \Nodo in {sum,stream,filter}
{
\node[rotate=90,font=\footnotesize] (dot)
at ( $ (\Nodo)!0.5!(\Nodo_n) $ ) {$\bullet\bullet\bullet$};
}
% Sum
\node[sum, right = of filter, node distance = 3em] (total) {$\sum$};
% Oneway delay
\node[block, right of = total, node distance = 7.5em] (delay) {One Way Delay};
\node[block, right of = delay, node distance = 15em] (segments) {$MP_1$ $|$ $Payload_1$ $\dots$ $MP_n$ $|$ $Payload_n$};
\node[output,right = of segments] (output) {};
% Inputs
\node[input,left = of sum_2] (output_2) {};
\node[input,left = of sum_n] (output_n) {};
% Lines Center Block
\draw[->] (input) -- node [name = begging] {$IN_2$} (sum);
\draw[->] (sum) -- node {} (stream);
\draw[->] (stream) -- node {} (filter);
\draw[->] (filter) -- node {} (total);
\draw[->] (total) -- node {} (delay);
\draw[->] (delay) -- node {} (segments);
\draw[->] (segments) -- node {Data} (output);
% Lines Above Center Block
\draw[->] (sum_2) -- node {} (stream_2);
\draw[->] (stream_2) -- node {} (filter_2);
\draw[->] (filter_2) -- node {} (total);
% Lines Below Center Block
\draw[->] (sum_n) -- node {} (stream_n);
\draw[->] (stream_n) -- node {} (filter_n);
\draw[->] (filter_n) -- node {} (total);
% Input Lines
\draw[->] (output_2) -- node {$IN_1$} (sum_2);
\draw[->] (output_n) -- node {$IN_n$} (sum_n);
\end{tikzpicture} }% End of makebox
\caption{New Tikz}
\label{fig:tikz }
\end{center}
\end{figure}
\end{document}
Die Idee besteht darin, zunächst alle Blöcke zu zeichnen und dann mithilfe der calc
Bibliothek (die Sie bereits geladen haben) die Kugeln genau in der Mitte zwischen der zweiten und dritten Ebene zu platzieren (dies kann mit einer einzigen Schleife erfolgen):
% Bullets
\foreach \Nodo in {sum,stream,filter}
{
\node[rotate=90,font=\footnotesize] (dot)
at ( $ (\Nodo)!0.5!(\Nodo_n) $ ) {$\bullet\bullet\bullet$};
}
Antwort2
Verwenden Sie einfach eine Größe kleiner als 1em
. Unten habe ich verwendet 0.7em
:
Anmerkungen:
- Für den vertikalen Abstand sollte man die
ex
Dimension anstelle von verwendenem
(was für den horizontalen Abstand verwendet werden sollte).
Code:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,calc} % braces {}
\usetikzlibrary{shapes,arrows,positioning}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\begin{document}
\tikzset{
block/.style={
draw,
rectangle,
minimum height=2em,
minimum width=5em,
},
sum/.style={
draw,
circle,
minimum size=2em
},
input/.style={coordinate},
output/.style={coordinate},
mytext/.style={
draw,
text depth=4pt,
text height=10pt
}
}
\begin{figure}[!ht]
\begin{center}
\makebox[\textwidth][c]{%
\begin{tikzpicture}[auto,>=latex']
% Blocks
\node[input, name = input] {};
\node[sum, right = of input, node distance = 1em] (sum) {MP};
\node[block, right of = sum, node distance = 6.5em] (stream) {Stream $2$};
\node[sum, right = of stream, node distance = 1em] (filter) {$F_2$};
\node[sum, above = of sum, node distance = 5em] (sum_2) {MP};
\node[block, right of = sum_2, node distance = 6.5em] (stream_2) {Stream$1$};
\node[sum, right = of stream_2, node distance = 1em] (filter_2) {$F_1$};
% Bullets
\node[below of = sum, node distance = 3em] (dot) {$\bullet$} -- (dot);
\node[below of = dot, node distance = 0.7em] (dot_2) {$\bullet$} -- (dot_2);
\node[below of = dot_2, node distance = 0.7em] (dot_3) {$\bullet$} -- (dot_3);
\node[below of = stream, node distance = 3em] (dot_4) {$\bullet$} -- (dot_4);
\node[below of = dot_4, node distance = 0.7em] (dot_5) {$\bullet$} -- (dot_5);
\node[below of = dot_5, node distance = 0.7em] (dot_6) {$\bullet$} -- (dot_6);
\node[below of = filter, node distance = 3em] (dot_7) {$\bullet$} -- (dot_7);
\node[below of = dot_7, node distance = 0.7em] (dot_8) {$\bullet$} -- (dot_8);
\node[below of = dot_8, node distance = 0.7em] (dot_9) {$\bullet$} -- (dot_9);
% Blocks
\node[input, name = input_n] {};
\node[sum, below = of dot_3, node distance = 1em] (sum_n) {MP};
\node[block, right of = sum_n, node distance = 6.5em] (stream_n) {Stream $n$};
\node[sum, right = of stream_n, node distance = 1em] (filter_n) {$F_n$};
% Sum
\node[sum, right = of filter, node distance = 3em] (total) {$\sum$};
% Oneway delay
\node[block, right of = total, node distance = 7.5em] (delay) {One Way Delay};
\node[block, right of = delay, node distance = 15em] (segments) {$MP_1$ $|$ $Payload_1$ $\dots$ $MP_n$ $|$ $Payload_n$};
\node[output,right = of segments] (output) {};
% Inputs
\node[input,left = of sum_2] (output_2) {};
\node[input,left = of sum_n] (output_n) {};
% Lines Center Block
\draw[->] (input) -- node [name = begging] {$IN_2$} (sum);
\draw[->] (sum) -- node {} (stream);
\draw[->] (stream) -- node {} (filter);
\draw[->] (filter) -- node {} (total);
\draw[->] (total) -- node {} (delay);
\draw[->] (delay) -- node {} (segments);
\draw[->] (segments) -- node {Data} (output);
% Lines Above Center Block
\draw[->] (sum_2) -- node {} (stream_2);
\draw[->] (stream_2) -- node {} (filter_2);
\draw[->] (filter_2) -- node {} (total);
% Lines Below Center Block
\draw[->] (sum_n) -- node {} (stream_n);
\draw[->] (stream_n) -- node {} (filter_n);
\draw[->] (filter_n) -- node {} (total);
% Input Lines
\draw[->] (output_2) -- node {$IN_1$} (sum_2);
\draw[->] (output_n) -- node {$IN_n$} (sum_n);
\end{tikzpicture} }% End of makebox
\caption{New Tikz}
\label{fig:tikz }
\end{center}
\end{figure}
\end{document}