# Match coordinate in two different scopes

I've many small pictures, each centered at (0,0) in their own figure but i need to combine them and in the combined picture the (0,0) of the 1st picture (in a scope) should be (4,2) of the 2nd picture - whats the best way to achieve this?

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\filldraw[green](4,5)circle(2pt);
\begin{scope}
\begin{scope}
%Should point at the green dot - (3,2)X and (4,5) should be matched
\draw[red,latex-](0,0)--(3,2);
\end{scope}
\begin{scope}
% Should be at the other end of the red vector (3,2)X and (0,0)XX should be matched
\draw[blue](0,0)circle(5pt);
\end{scope}
\end{scope}
\end{tikzpicture}
\end{document}


The X after the coordinates are there to visualise, that these coordinates are (should be valid) in different scopes)

PS: Currently I'm doing it with xshift, yshift but that's kinda tedious.

-
Welcome to TeX.SX! You can have a look on our our starter page to familiarize yourself further with our format. –  Claudio Fiandrino Jul 12 '13 at 7:04
Can you include a simple example with two scopes starting from \documentclass{...} up to the \end{document}? –  percusse Jul 12 '13 at 7:24

Use named coordinates, such as:

\coordinate (x) at (4,5);
\coordinate (y) at (3,2);
\filldraw[green](x)circle(2pt);
...
\draw[red,latex-](0,0)--(y);
...


Furthermore you could do relative positioning, and calculations, if desired.

If you would like to use such coordinates in several TikZ pictures, use the option remember picture.

For the part of moving the origin, it's a bit easier to shift the scope via a coordinate that using xshift, yshift, such as in

\begin{scope}[shift={(1,3)}]
\draw[red,latex-](0,0)--(3,2);
\end{scope}


Though you need to know the difference to specify it.

-
But if i use some fragments in many different environments this wont work fine i think. I would like to stay away from fixed names for some coordinates for some pictures and make it as general as possible (in my opinion having several pictures centered around (0,0) and then i'ld only have to match the centerpoints of these pictures. –  oerpli Jul 12 '13 at 7:56
@oerpli I hope, this information about naming and using fixed coordinates, which you can use in different scopes, helps in the original question. If you would have a follow-up question about moving a (0,0) point of one scope to match somehow another scope, possibly create another specific question (if you don't find an existing answer). –  Stefan Kottwitz Jul 12 '13 at 8:01
I thought this question is about that. Maybe i haven't phrased it that well. –  oerpli Jul 12 '13 at 8:05
@oerpli I added something for shifting the origin. –  Stefan Kottwitz Jul 12 '13 at 8:30
@oerpli shift also accepts named coordinates, e.g., shift=(x) (no brace is needed since there is no comma inside the parentheses). –  percusse Jul 12 '13 at 8:59