Tenho tentado criar meu segundo modelo Tikz baseado emTikZ: Diagrama de um perceptron. Consegui modificá-lo com base no meu conhecimento e experimentação de iniciante, mas a parte que me falta e não consigo descobrir como fazer as balas. Estou tentando diminuir a distância, mas não há efeito. Eu tentei, distance node = 1 em
mas não tive sucesso no momento. Existe uma solução possível para o meu problema? Uma amostra da saída é fornecida. Qualquer sugestão será apreciada.
\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}
Responder1
Eu sugiro uma abordagem diferente que manterá um espaçamento consistente entre as camadas:
\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}
A ideia é primeiro desenhar todos os blocos e depois usar a calc
biblioteca (que você já carregou) para colocar os marcadores exatamente no meio do caminho entre a segunda e a terceira camadas (isso pode ser feito com um único loop):
% Bullets
\foreach \Nodo in {sum,stream,filter}
{
\node[rotate=90,font=\footnotesize] (dot)
at ( $ (\Nodo)!0.5!(\Nodo_n) $ ) {$\bullet\bullet\bullet$};
}
Responder2
Basta usar um tamanho menor que 1em
. Abaixo usei 0.7em
:
Notas:
- Para espaçamento vertical deve-se usar a
ex
dimensão em vez deem
(que deve ser usada para distância horizontal.
Código:
\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}