\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3.5cm,
thick,main node/.style={rectangle,draw,font=\sffamily\Large\bfseries}]
\node[main node] (C4) {C4};
\node[main node] (IN3M) [left of=C4] {IN3M};
\node[main node] (TDC) [right of=C4] {TDC};
\node[main node] (C5) [above right of=C4] {C5};
\node[main node] (S3M) [right of=C5] {S3M};
\node[main node] (P5) [above right of=C5] {P5};
\node[main node] (C6) [above of=C4] {C6};
\node[main node] (C7) [right of=C6] {C7};
\node[main node] (P7) [above right of=C7] {P7};
\node[main node] (S1M) [right of=C7] {S1M};
\node[main node] (P6) [above of=C6] {P6};
\node[main node] (C1) [below of=C4] {C1};
\node[main node] (C3) [below of=C1] {C3};
\node[main node] (IN1M) [below of=C3] {IN1M};
\node[main node] (IN1S2) [below of=IN1M] {IN1S2};
\node[main node] (IN1XS2) [below of=IN1S2] {IN1XS2};
\node[main node] (IN1XS3) [right of=IN1XS2] {IN1XS3};
\node[main node] (IN1S1) [left of=IN1S2] {IN1S1};
\node[main node] (IN1XS1) [below of=IN1S1] {IN1XS1};
\node[main node] (IN1S3) [right of=IN1S2] {IN1S3};
\path[every node/.style={font=\sffamily\small}]
(C4) edge node [left] {EW} (C6)
edge node [left] {EW} (C1)
edge node [above] {EW} (IN3M)
edge node [right] {EW} (C5)
edge node [above] {EW} (TDC)
(C6) edge node [above] {EW} (C7)
(C6) edge node [left] {EW} (P6)
(C7) edge node [above] {EW} (S1M)
edge node [left] {EW} (P7);
\end{tikzpicture}
\end{document}
Asked
Active
Viewed 125 times
4
Zarko
- 296,517
T. Fletcher
- 41
1 Answers
5
Like this?
In positioning of nodes is used library positioning. By it use the distance between nodes are determined by node distance. Beside this library also are used arrows.meta for arrows, calc for calculation of positions of some nodes, chains for positioning of nodes in chaions, quotes for labeling of edges (where it is present) and shapes.multipart for nodes, which are densely tied.
MWE below is not complete. Drawing of missing lines I left to you, also to check if the text in nodes are correct. I hope that it will serve as good starting point ...
\documentclass{article}
\usepackage[margin=20mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, calc, chains, positioning, quotes, shapes.multipart}
\begin{document}
\begin{tikzpicture}[
node distance = 7mm and 9mm,
start chain = going below,
every edge/.style = {draw, semithick, Stealth-Stealth,
shorten <=1pt, shorten >=1pt,
font=\footnotesize\sffamily,
inner ysep=1pt, auto},
every label/.append style = {align=center,
font=\sffamily\linespread{0.84}\selectfont},
box/.style = {rectangle, draw,
fill=#1,
minimum width=12mm, inner sep= 2mm, outer sep=0mm,
font=\small\bfseries\sffamily,
on chain},
mpx/.style args = {#1/#2}{% multi part box
rectangle split, draw,
rectangle split parts=#1,
fill=green!#2,
minimum width=12mm, inner sep= 2mm, outer sep=0mm,
font=\small\bfseries\sffamily,
on chain}
]
% column 1
\node (n11) [mpx=3/30] {\nodepart{one} S2X51
\nodepart{two} S2X52
\nodepart{three} S2X53};
\node (n12) [mpx=2/30] {\nodepart{one} S2X54
\nodepart{two} S2X55};
\node (n13) [mpx=2/30] {\nodepart{one} S2X56
\nodepart{two} S2X57};
\node (n14) [box=green!30] {S2X57};
\coordinate[on chain] (n15);
\node (n16) [mpx=3/30,dashed]
{\nodepart{one} A2SX1
\nodepart{two} A2SX2
\nodepart{three} A2SX3};
% column 2
\node (n21) [box=green!30,right=of n11] {S2S1};
\node (n22) [box=green!30,right=of n12] {S2S2};
\node (n23) [box=green!30,right=of n13] {S2S3};
\node (n24) [box=green!30,right=of n14] {S2S4};
\node (n25) [mpx=3/30,dashed, right=of n16]
{\nodepart{one} A2S1
\nodepart{two} A2S2
\nodepart{three} A2S3};
\node (n26) [mpx=2/60] {\nodepart{one} N251
\nodepart{two} N252};
% column 3
\node (n31) [box=green!30,right=of $(n22.east)!0.5!(n23.east)$] {S2M};
\node (n32) [box=green!60,right=of n15 -| n24.east] {IN3M};
\node (n33) [box=green!30,dashed, right=of n25] {A2M};
\node (n34) [box=green!60,right=of n26] {IN2M};
% column 4: main column
\node (n41) [box=blue!30,above right=of n11.north -| n31.east] {P6};
\node (n42) [box=orange!30, right=of n31] {C6};
\node (n43) [box=orange!30, right=of n32] {C4};
\node (n44) [box=orange!30,right=of $(n33.east)!0.5!(n34.east)$] {C1};
\node (n45) [box=orange!30] {C3};
\node (n46) [box=green!60] {IN1M};
\node (n47) [box=green!60] {IN1S2};
%
\node (n48) [box=green!60,below left =of n47.south east] {IN1XS2};
\node (n49) [box=green!60,below right=of n47.south west] {IN1XS3};
% column 5
\node (n51) [box=orange!30,right=of n42] {C7};
\node (n52) [box=orange!30,above right=of n43] {C5};
\node (n53) [box=orange!30,right=of n44] {C2};
% column 6
\node (n61) [box=blue!30,right=of n41 -| n51.east] {P7};
\node (n62) [box=green!30,right=of n51] {S1M};
\node (n63) [box=green!30,right=of n52] {S3M};
\node (n64) [box=green!30,dashed, right=of n53] {A1M};
% column 7
\node (n71) [box=yellow!50,
label=above:{TDC: Theater\\ Distribution\\ Center},
right=of n43 -| n64.east] {TDC};
\node (n72) [mpx=2/30,dashed,right=of n64]
{\nodepart{one} A1S1
\nodepart{two} A1S2};
% column 8
\node (n81) [box=blue!30,
above right=of n63 -| n71.east] {PS};
\node (n82) [box=blue!30,right=of n71] {PORT};
\node (n83) [box=blue!30] {P1};
% bottom two rows
% column 3'
\node (n491) [box=green!60,left =of n47 -| n34] {IN1S1};
\node (n492) [box=green!60] {IN1XS1};
% column 5'
\node (n493) [box=green!60,right=of n47 -| n53] {IN1S3};
\node (n494) [box=green!60] {IN1XS4};
% lines
\path
% between column 1 and 2
(n11.one east) edge (n21)
(n11.two east) edge (n21)
(n11.three east) edge (n21)
% ...
% between column 2 and 3
(n21) edge (n31)
(n22) edge (n31)
(n23) edge (n31)
(n24) edge (n31)
% ...
% between column 3 and 4
(n31) edge (n42)
% ...
% main column
(n41) edge (n42)
(n42) edge (n43)
(n43) edge (n44)
(n44) edge (n45)
(n45) edge["EV"] (n46)
(n46) edge["EV"] (n47)
%
(n47) edge["EV" '] (n48)
(n47) edge["EV"] (n49)
%
(n47) edge["EV" '] (n491)
(n47) edge["EV"] (n493)
%
(n491) edge["EV" '] (n492)
(n493) edge["EV"] (n494)
;
\end{tikzpicture}
\end{document}
Note:
This diagram is very large, so I increase text width with adding package geometry and also reduce font size in image that nodes can be smaller.
Zarko
- 296,517
-
Thanks so much, yes this provided a good starting point for me. I appreciate the help, I am new to latex and used google to help me get started. – T. Fletcher Jul 03 '17 at 19:30
-
@T.Fletcher, if answer help you, you can vote and accept it (by clicking up-pen and check mark at top left side of answer) :-). If you will stuck somewhere in finishing of given example, don't hesitate to ask new question. – Zarko Jul 03 '17 at 19:38


positioninglibrary and thenleft=20pt of <node>or whatever. More flexible. – cfr Jun 26 '17 at 17:29