Tikzグラフィックのヘルプ

Tikzグラフィックのヘルプ

この図を作成するように依頼されました。

オリジナル

MWE からわかるように、私が改善したい部分は、左側の 3 つのくさび形のアイコン (患者、病院スタッフ、訪問者) と 3 つの矢印だけです。そのノード形状を取得する方法や、矢印を直角に結合する方法がわかりません。

ここに画像の説明を入力してください

MWE:

\documentclass[border={2pt 2pt 2pt 2pt}]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning} 
\usetikzlibrary{shapes.geometric,shapes.arrows,positioning}

\begin{document}
\begin{tikzpicture}[fill=red!20]
%\draw[step=0.5cm,color=gray] (-15,-15) grid (15,15);
\draw[thick, fill=blue!25] (-5,-5) -- (-5,7) -- (7,7) -- (7,-5)-- (-5,-5);
\draw[thick, fill=red!25] (-4.8,-1) -- (-4.8,6.8) -- (6.8,6.8) -- (6.8,1)-- (3,1) -- (3,-1) -- (-4.8,-1);
\draw[thick, fill=yellow!25] (-4.8,-1.2) -- (3.2,-1.2) -- (3.2,0.8) -- (6.8,0.8)-- (6.8,-4.8) -- (-4.8,-4.8) -- (-4.8,-1.2);

\path 
(0,.5) node(a) [fill=white,ellipse,draw,align=center]{ Milling \&\\ Meeting Area}
(-2.5,-2.5) node(b) [fill=white,rectangle,rotate=0,draw,align=center] { Beverage\\Pantry}
(0.5,-2.5) node(c)  [fill=white,rectangle,rotate=0,draw,align=center] { Offices}
(3.5,-2.5) node(d)  [fill=white,rectangle,rotate=0,draw,align=center] { Quiet\\Room}
(0,-3) node(e)  [rotate=0,align=center] { Secure Rooms}
(-3,-6) node(f) [draw, arrow box, arrow box arrows={north:.5cm}] { Volunteers}
(0,-6) node(g) [draw, arrow box, arrow box arrows={north:.5cm}] { Chaplains}
(3,-6) node(h)  [draw, arrow box, arrow box arrows={north:.5cm,south:.5cm}] { Visiting on \\ Wards}
(-6,1) node(i)  [draw, arrow box, arrow box arrows={east:.5cm}] { Visitors}
(-6,0) node(j)  [draw, arrow box, arrow box arrows={east:.5cm}] {Hospital Staff}
(-6,-1) node(k) [draw, arrow box, arrow box arrows={east:.5cm}] { Patients}
(-3.1,3.5) node(l) [fill=white,rectangle,rotate=0,draw,align=center] { Hindu \& Sikh\\ Prayer Room}
(-.5,3.5) node(m) [fill=white,rectangle,rotate=0,draw,align=center] { New St Luke's\\Chapel}
(2,3.5) node(n) [fill=white,rectangle,rotate=0,draw,align=center] { Main Public\\Space}
(5,3.5) node(o) [fill=white,rectangle,rotate=0,draw,align=center] { Muslim Prayer\\Rooms \&\\Washing Facilities}
(5,-1) node(p)  [fill=white,rectangle,rotate=0,draw,align=center] {MDT Room}
 (1,6) node(q)  [rotate=0,align=center] {\Large Open 24 hours a day}
;


        
\draw[black,triangle 45-triangle 45] (a) -- (b);
\draw[black,triangle 45-triangle 45] (a) -- (c);
\draw[black,triangle 45-triangle 45] (b) -- (c);
\draw[black,triangle 45-triangle 45] (a) -- (d);
\draw[black,triangle 45-triangle 45] (l) -- (a);
\draw[black,triangle 45-triangle 45] (m) -- (a);
\draw[black,triangle 45-triangle 45] (n) -- (a);
\draw[black,triangle 45-triangle 45] (o) -- (a);
\draw[black,triangle 45-triangle 45] (p) -- (o);
\draw[black,triangle 45-triangle 45] (j) -- (a);
\draw[black,triangle 45-triangle 45] (o) -- (a);
\draw[black,triangle 45-triangle 45] (p) -- (o);
\draw[black,triangle 45-triangle 45] (i) -- (a);
\draw[black,triangle 45-triangle 45] (k) -- (a);



\draw[thick] (-4.8,-1.2) -- (3.2,-1.2) -- (3.2,0.8) -- (6.8,0.8)-- (6.8,-4.8) -- (-4.8,-4.8) -- (-4.8,-1.2);


\end{tikzpicture}


\end{document}

答え1

以下では、ライブラリを使用して、適切な外観などを得るために必要なノードの形状shapes.symbolsを取得します。signalHospital Staff

また、位置を変更し(ノードを使用して(a)高さを正しくする)、矢印を変更して希望どおりになるようにしました。

\documentclass[border={2pt 2pt 2pt 2pt}]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning} 
\usetikzlibrary{shapes.geometric,shapes.arrows,shapes.symbols,positioning}

\begin{document}
\begin{tikzpicture}[fill=red!20, in arrows/.style={signal, signal to=east, text width = 1.5cm, minimum height=2\baselineskip, align=center}]
%\draw[step=0.5cm,color=gray] (-15,-15) grid (15,15);
\draw[thick, fill=blue!25] (-5,-5) -- (-5,7) -- (7,7) -- (7,-5)-- (-5,-5);
\draw[thick, fill=red!25] (-4.8,-1) -- (-4.8,6.8) -- (6.8,6.8) -- (6.8,1)-- (3,1) -- (3,-1) -- (-4.8,-1);
\draw[thick, fill=yellow!25] (-4.8,-1.2) -- (3.2,-1.2) -- (3.2,0.8) -- (6.8,0.8)-- (6.8,-4.8) -- (-4.8,-4.8) -- (-4.8,-1.2);

\path 
(0,.5) node(a) [fill=white,ellipse,draw,align=center]{ Milling \&\\ Meeting Area}
(-2.5,-2.5) node(b) [fill=white,rectangle,rotate=0,draw,align=center] { Beverage\\Pantry}
(0.5,-2.5) node(c)  [fill=white,rectangle,rotate=0,draw,align=center] { Offices}
(3.5,-2.5) node(d)  [fill=white,rectangle,rotate=0,draw,align=center] { Quiet\\Room}
(0,-3) node(e)  [rotate=0,align=center] { Secure Rooms}
(-3,-6) node(f) [draw, arrow box, arrow box arrows={north:.5cm}] { Volunteers}
(0,-6) node(g) [draw, arrow box, arrow box arrows={north:.5cm}] { Chaplains}
(3,-6) node(h)  [draw, arrow box, arrow box arrows={north:.5cm,south:.5cm}] { Visiting on \\ Wards}
(a)++(-5.5,0) node(j)  [draw, anchor=east, in arrows] {Hospital Staff}
(j.east)++(0,1) node(i)  [draw, anchor=east, in arrows] { Visitors}
(j.east)++(0,-1) node(k) [draw, anchor=east, in arrows] { Patients}
(-3.1,3.5) node(l) [fill=white,rectangle,rotate=0,draw,align=center] { Hindu \& Sikh\\ Prayer Room}
(-.5,3.5) node(m) [fill=white,rectangle,rotate=0,draw,align=center] { New St Luke's\\Chapel}
(2,3.5) node(n) [fill=white,rectangle,rotate=0,draw,align=center] { Main Public\\Space}
(5,3.5) node(o) [fill=white,rectangle,rotate=0,draw,align=center] { Muslim Prayer\\Rooms \&\\Washing Facilities}
(5,-1) node(p)  [fill=white,rectangle,rotate=0,draw,align=center] {MDT Room}
 (1,6) node(q)  [rotate=0,align=center] {\Large Open 24 hours a day}
;


        
\draw[black,triangle 45-triangle 45] (a) -- (b);
\draw[black,triangle 45-triangle 45] (a) -- (c);
\draw[black,triangle 45-triangle 45] (b) -- (c);
\draw[black,triangle 45-triangle 45] (a) -- (d);
\draw[black,triangle 45-triangle 45] (l) -- (a);
\draw[black,triangle 45-triangle 45] (m) -- (a);
\draw[black,triangle 45-triangle 45] (n) -- (a);
\draw[black,triangle 45-triangle 45] (o) -- (a);
\draw[black,triangle 45-triangle 45] (p) -- (o);
\draw[black,triangle 45-triangle 45] (o) -- (a);
\draw[black,triangle 45-triangle 45] (p) -- (o);

\draw[black, triangle 45-triangle 45] (i) -- ++(3,0) coordinate(tmp) |- (k);
\draw[black, triangle 45-triangle 45] (j) -- (j-|tmp) -- (a);



\draw[thick] (-4.8,-1.2) -- (3.2,-1.2) -- (3.2,0.8) -- (6.8,0.8)-- (6.8,-4.8) -- (-4.8,-4.8) -- (-4.8,-1.2);


\end{tikzpicture}


\end{document}

ここに画像の説明を入力してください

基本的に同じノードに異なるテキストを使用して、\foreachすべての矢印を描画するという繰り返しタスクを実行するコード バリアントですcycle。該当する場合は、このコード バリアントを使用します。

\documentclass[border={2pt 2pt 2pt 2pt}]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows} 
\usetikzlibrary{shapes.geometric,shapes.arrows,shapes.symbols}

\begin{document}
\begin{tikzpicture}[
    fill=red!20,
    in arrows/.style={draw, signal, signal to=east, text width = 1.5cm, minimum height=2\baselineskip, align=center},
    boxes/.style={fill=white, rectangle, draw, align=center},
    arrowboxes/.style={draw, arrow box, arrow box arrows={#1}}
  ]
%\draw[step=0.5cm,color=gray] (-15,-15) grid (15,15);
\draw[thick, fill=blue!25] (-5,-5) -- (-5,7) -- (7,7) -- (7,-5)-- cycle;
\draw[thick, fill=red!25] (-4.8,-1) -- (-4.8,6.8) -- (6.8,6.8) -- (6.8,1)-- (3,1) -- (3,-1) -- cycle;
\draw[thick, fill=yellow!25] (-4.8,-1.2) -- (3.2,-1.2) -- (3.2,0.8) -- (6.8,0.8)-- (6.8,-4.8) -- (-4.8,-4.8) -- cycle;

\path 
(0,.5) node(a) [fill=white,ellipse,draw,align=center]{ Milling \&\\ Meeting Area}
(-2.5,-2.5) node(b) [boxes] { Beverage\\Pantry}
(0.5,-2.5) node(c)  [boxes] { Offices}
(3.5,-2.5) node(d)  [boxes] { Quiet\\Room}
(0,-3) node(e)  [align=center] { Secure Rooms}
(-3,-6) node(f) [arrowboxes={north:.5cm}] { Volunteers}
(0,-6) node(g) [arrowboxes={north:.5cm}] { Chaplains}
(3,-6) node(h)  [arrowboxes={north:.5cm,south:.5cm}] { Visiting on \\ Wards}
(a)++(-5.5,0) node(j)  [anchor=east, in arrows] {Hospital Staff}
(j.east)++(0,1) node(i)  [anchor=east, in arrows] { Visitors}
(j.east)++(0,-1) node(k) [anchor=east, in arrows] { Patients}
(-3.1,3.5) node(l) [boxes] { Hindu \& Sikh\\ Prayer Room}
(-.5,3.5) node(m) [boxes] { New St Luke's\\Chapel}
(2,3.5) node(n) [boxes] { Main Public\\Space}
(5,3.5) node(o) [boxes] { Muslim Prayer\\Rooms \&\\Washing Facilities}
(5,-1) node(p)  [boxes] {MDT Room}
(1,6) node(q) {\Large Open 24 hours a day}
;


\foreach\x in {b,c,d,l,m,n,o}
  \draw[black,triangle 45-triangle 45] (a) -- (\x);
\draw[black,triangle 45-triangle 45] (b) -- (c);
\draw[black,triangle 45-triangle 45] (p) -- (o);

\draw[black, triangle 45-triangle 45] (i) -- ++(3,0) coordinate(tmp) |- (k);
\draw[black, triangle 45-triangle 45] (j) -- (j-|tmp) -- (a);



\draw[thick] (-4.8,-1.2) -- (3.2,-1.2) -- (3.2,0.8) -- (6.8,0.8)-- (6.8,-4.8) -- (-4.8,-4.8) -- cycle;


\end{tikzpicture}


\end{document}

関連情報