11

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
8

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

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

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} 

enter image description here

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.