# TikZ: How to rotate and then shift?

I'm trying to rotate a node and then shift it along the X axis. If I do [rotate=90, xshift=-20pt], the node will first shift and then rotate.

• You need to change the order of the transformations. The first transformation applied is the last of the options. – Alain Matthes Dec 26 '11 at 7:52

You could nest the rotated object inside a shifted scope, i.e.

\begin{scope}[xshift=-20pt]
\draw [rotate=90] ...;
\end{scope}


The scope is not necessary. You have two solutions

1) with cm={0,1,-1,0,(-20pt,0cm)}

2) you can try to change the order of your transformations with xshift=-20 pt,rotate=90and not rotate=90,xshift=-20 pt.

\documentclass{scrartcl}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw[red,->] (0,0) -- (1,1);
\draw[blue,->,cm={0,1,-1,0,(-20pt,0cm)}] (0,0) -- (1,1);
\end{tikzpicture}

\begin{tikzpicture}
\draw[red,->] (0,0) -- (1,1);
\draw[blue,->,xshift=-20 pt,rotate=90]  (0,0) -- (1,1);
\draw[green,->,rotate=90,xshift=-20 pt] (0,0) -- (1,1);
\end{tikzpicture}

\end{document}


• Ah, didn't know that the order had such an effect. Well, I'll remember that till next time. – gablin Dec 27 '11 at 8:47