[Tex/LaTex] How to move a part of a picture with tikzpicture

horizontal alignmenttikz-pgf

I'm drawing a picture by using tikzpicture. Suppose the picture is made by many objects. At the end of my work I realize that I need to move only one of these objects, say shift right by 1 unit. Clearly I can change all coordinates by (a,b) –> (a+1,b). Clearly this is not a good solution.

In the classical ambient picture there is the command \put(x,y){...} that allow you to move an entire sub-part of a picture.

Is there anything similar in the ambient tikzpicture? Is there any workaround?

Best Answer

You can apply a common transformation to several objects by placing them in a scope. Example from the TikZ/pgf Manual (section 25.3):

\begin{tikzpicture}
    \draw[help lines] (0,0) grid (3,2);
    \draw (0,0) rectangle (1,0.5);
    \begin{scope}[xshift=1cm]
        \draw[red] (0,0) rectangle (1,0.5);
        \draw[yshift=1cm] [blue] (0,0) rectangle (1,0.5);
        \draw[rotate=30] [orange] (0,0) rectangle (1,0.5);
    \end{scope}
\end{tikzpicture}
Related Question