# How to apply 3D transform to arrows in TikZ

Consider this minimal example. How can I get the arrow to 'rotate' like everything else is rotating in the diagram? I have tried using transform shape but this does not apply to the arrows.

\documentclass[tikz,margin=5pt]{standalone}
\usetikzlibrary{3d}

\begin{document}

\begin{tikzpicture}
\draw[left color=blue,right color=red] (0,0) -- (1,0) -- (1,1) -- (0,1) -- cycle;
\node at (0.5,2) (Label) {Test};
\draw[->,line width=1mm] (Label) -- (0.5,1.1);
\end{tikzpicture}

\begin{tikzpicture}[y={(0.5cm,-0.5cm)},x={(0.5cm,1cm)}, z={(0cm,1cm)}]
\begin{scope}[canvas is yz plane at x=0,transform shape]
\draw[left color=blue,right color=red] (0,0) -- (1,0) -- (1,1) -- (0,1) -- cycle;
\node at (0.5,2) (Label) {Test};
\draw[->,line width=1mm] (Label) -- (0.5,1.1);
\end{scope}
\end{tikzpicture}

\end{document}


Another example of the perspective of the arrow being 'off'.

\draw[->,line width=1mm] (1,1.5) -- (0,1.5);

• Instead of [y={(0.5cm,-0.5cm)},x={(0.5cm,1cm)}, z={(0cm,1cm)}]. Use a canvas transform={cm=...}. May 18, 2018 at 0:49
• You can read off the transformation "matrix" by putting \pgfgettransform{\mytrafo} \typeout{\mytrafo} in your scope. @Symbol1 canvas transform or transform canvas?
– user121799
May 18, 2018 at 1:01
• @marmot You are right. Presumably transform canvas={yslant=1}. May 18, 2018 at 1:02

The pgfmanual is still full of surprises (at least for me ;-). Here is a solution that works for explicit coordinates but not for symbolic ones like (Label1). (Only @Symbol 1 may do the symbolic ones, I guess. ;-) The command I was looking for is \pgflowlevelsynccm.

\documentclass[tikz,margin=5pt]{standalone}
\usetikzlibrary{3d}
\begin{document}

\begin{tikzpicture}[y={(0.5cm,-0.5cm)},x={(0.5cm,1cm)}, z={(0cm,1cm)}]
\begin{scope}[canvas is yz plane at x=0,transform shape]
\draw[left color=blue,right color=red] (0,0) -- (1,0) -- (1,1) -- (0,1) -- cycle;
\node at (0.5,2) (Label) {Test};
\pgflowlevelsynccm
\draw[->,line width=1mm] (0.5,1.8) -- (0.5,1.1);
\end{scope}
\begin{scope}[canvas is yz plane at x=2,transform shape]
\draw[left color=blue,right color=red] (0,0) -- (1,0) -- (1,1) -- (0,1) -- cycle;
\node at (0.5,2) (Label) {Test};
\pgflowlevelsynccm
\draw[->,line width=1mm] (1,1.5) -- (0,1.5);
\end{scope}
\end{tikzpicture}

\end{document}


• The reason why it "does not work" for symbolic coordinates is that e.g. south in (node.south) changes its meaning under the coordinate transformations.
– user121799
May 18, 2018 at 16:12