I have the following code:
\documentclass[tikz,border=4pt]{standalone} \usetikzlibrary{matrix} \begin{document} \begin{tikzpicture} \matrix (P) [ matrix of nodes, nodes={circle,draw}, column sep=1cm, row sep=1cm] { A & B & C \\ D & E & F \\ G & H & I \\ }; \draw[red] (P-1-1) -- (P-2-3); \draw[blue] ([shift={(.5cm,.5cm)}]P-2-1) node[rectangle,draw] {why not from here?} -- (P-3-3); \fill[green,draw] ([shift={(.5cm,.5cm)}]P-2-1) circle [radius=2pt] -- (P-3-3); \end{tikzpicture} \end{document} I want the ([shift={(.5cm,.5cm)}]P-2-1) to start from the "green" point, but in:
\draw[blue] ([shift={(.5cm,.5cm)}]P-2-1) node[rectangle,draw] {why not from here?} -- (P-3-3); It doesn't perform as my expected.
What cause this? How can I use ([shift={(.5cm,.5cm)}]P-2-1) to locate the "green point"'s position?
Edit
If I use ++(.5cm,.5cm) syntax, it's hard to do something below:
I want to plot the cyan line(in only ONE path, and better not to define aux coordinate/nodes), but with green path's syntax, shift is not parsed as my expected intuitively.
\documentclass[tikz,border=4pt]{standalone} \usetikzlibrary{matrix} \begin{document} \begin{tikzpicture} \matrix (P) [ matrix of nodes, nodes={circle,draw}, column sep=1cm, row sep=1cm] { A & B & C \\ D & E & F \\ G & H & I \\ }; \draw[red] (P-1-1) -- (P-2-3); \draw[green] (P-2-1) -- ++(.5cm,.5cm) -- ([shift={(-5mm,-5mm)}]P-3-3) -- (P-3-3) ; \draw[cyan] (P-2-1) ++(.5cm,.5cm) coordinate (x) -- (P-2-1) (P-3-3) ++(-.5cm,-.5cm) -- (x) (P-3-3) ++(-.5cm,-.5cm) coordinate (y) (y) -- (P-3-3) ; \end{tikzpicture} \end{document} 





++syntax is convenient in some places, less so in others. I would use it at the start here, but not at the end, most likely. or I would set the coordinates first.\draw[green] (P-3-3) ++(-5mm,-5mm) coordinate (y) (P-2-1) -- ++(5mm,5mm) coordinate (x) -- (y) -- (P-3-3);.shiftcan be funny. I am not sure if this is a bug or a feature I do not understand.([shift=<...>]P-x-y)is not always the best, but these strangeshiftbehaviour of the nodes inmatrixis what make me totally confused.... IMHO, it's more like a bug.