Skip to main content
1 of 2
MS-SPO
  • 23.8k
  • 3
  • 23
  • 63

shift expects polar coordinates. Giving cartesian ones won't compile. Use xshift and yshift if you prefer cartesian (with units) as option. - Kindly watch the syntax used.

\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=(45:2)]P-2-1) node[rectangle,draw] {polar shift} -- (P-3-3); \draw ([xshift=1cm,yshift=.5cm]P-2-1) node[rectangle,draw,magenta] {x- and y-shift} -- (P-3-3); \fill[green,draw] ([shift={(.5cm,.5cm)}]P-2-1) circle [radius=2pt] -- (P-3-3); \end{tikzpicture} \end{document} 

result

MS-SPO
  • 23.8k
  • 3
  • 23
  • 63