It is difficult to google for this problem, as I use the to
command in tikz in order to bend edges left or right.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\begin{document}
\newlength{\nodedist}
\setlength{\nodedist}{5cm}
\begin{tikzpicture}[
mynode/.style={text width=4cm,draw,rounded
corners=5pt,shape=rectangle,minimum width=1cm,text depth=2cm,inner sep=5pt},
node distance=\nodedist,
arrow label/.style={midway,fill=white,draw,shape=rectangle,rounded corners=3pt},
]
\draw (0,0) node[mynode] (model) {
\makebox[4cm]{Model}\\
\hrulefill \\
};
\node[mynode,right=of model] (view) {
\makebox[4cm]{View}\\
\hrulefill \\
};
\node[mynode] (controller) at ($(model) !0.5! (view) + (0,-\nodedist)$) {
\makebox[4cm]{Controller}\\
\hrulefill \\
};
\draw[->] (controller.west) to[bend left,red] node[arrow label] {Change state} (model.south);
\draw[->] (controller.east) to[bend right] node[arrow label] {Update display} (view.south);
\draw[->] (view.west) to[bend right] node[arrow label] {Send user input} (controller.north);
\draw[->] (view.north) to[bend right] node[arrow label] {Request state} (model.north);
\draw[->] (model.east) to[bend left] node[arrow label] {Notify of change} (view.north west);
\end{tikzpicture}
\end{document}
I want to change the arrow colour without affecting the nodes placed along it. Is this straightforwardly possible?
I could use edge
from the graph library, but I wonder if it can be done with to
.
Best Answer
You can use a
scope
with the optionExample:
To prevent this from making the node borders red, use
draw=black
inFull code: