I want to draw an edge that connects multiple nodes. I am able to achieve this using the ''to'' feature as shown in example below:
\documentclass[convert={density=300,size=1080x800,outext=.png}]{ standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\matrix (m)[column sep=.5in, row sep=.5in, ampersand replacement=\&]{
\node[] (r1c1) {}; \& \node[] (r1c2) {}; \& \node[] (r1c3) {}; \\
\node[] (r2c1) {}; \& \node[] (r2c2) {}; \& \node[] (r2c3) {}; \\
};
\draw (r1c1) to[<-] (r2c1.center) to (r2c2.center) to (r1c2);
\end{tikzpicture}
\end{document}
The output looks as follows:
I am not able to change the property of the individual segment or connectors. For e.g. tikz discarded the directive for putting an arrow on the first leg of the connected. What I want to achieve to begin with is rounded corners.
Just to follow up along this line, below are three ways to achieve edge through multiple nodes
\documentclass[convert={density=300,size=1080x800,outext=.png{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\matrix (m)[column sep=.5in, row sep=.5in, ampersand replacement=\&]{
\node[] (r1c1) {}; \& \node[] (r1c2) {}; \& \node[] (r1c3) {}; \\
\node[] (r2c1) {}; \& \node[] (r2c2) {}; \& \node[] (r2c3) {}; \\
};
\draw (r1c1) edge (r2c1.center) edge (r2c2.center) edge (r1c2);
\end{tikzpicture}
\begin{tikzpicture}
\matrix (m)[column sep=.5in, row sep=.5in, ampersand replacement=\&]{
\node[] (r1c1) {}; \& \node[] (r1c2) {}; \& \node[] (r1c3) {}; \\
\node[] (r2c1) {}; \& \node[] (r2c2) {}; \& \node[] (r2c3) {}; \\
};
\draw (r1c1) -- (r2c1.center) -- (r2c2.center) -- (r1c2);
\end{tikzpicture}
\end{document}
The output of which looks as follows:
Using edge doesn't work, but would have been the most flexible one.
(m-row-col)
, you can use(m-1-2)
instead of(r1c2)
. Second, AFAIKto
operators do not take arrow tips as Option. You can either split the path or use the markings decorations for the arrows. For rounded corners you can also split the path or, it's also possible to use acurve to
but that's more of a Workaround than a solution.*
For the rounded corners it may be possible to change in the middle of the path, but I'm not sure, I'd have to confirm it.matrix of nodes
ormatrix of math nodes
for the automatic naming though, right? And if you add a\node
or something in a cell, then that node will not be given a name.