# How to rescale, displace and combine two graphics with tikz?

I need to create to graphics with TiKZ, on inside the other. The first bigger graphic, is made by plotting some data points. The smaller graphic is some semi-circle with some vectors, which I want to place at the left bottom (empty space) of the big graphic. I originally created the two graphs independently as I was planning to use them separately but I would now to combine them into one. Here is a simplified version of my code:

\documentclass[crop,tikz]{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}[scale=3]
\begin{axis}[]
(2,-2.8559703)
(3,-3.5301677)
(4,-4.3050655)
(5,-5.1413136)
(6,-6.0322865)
(7,-6.9675052)
(8,-7.9377747)
};
\end{axis}

% The code for the second smaller graphic starts here

%axes
\draw  [ ->] (0,-0.1) -- (0,1.1);
\draw  [ ->] (-1.1,0) -- (1.1,0);
%The two vectors
\draw [dotted] [ ->] [line width=0.2mm] (0,0) -- (0.707,0.707);
\draw [dotted] [ ->] [line width=0.2mm] (0,0) -- (-0.65,0.375);
%the semicricle
\clip (-1.2,0) rectangle (1.,1.);
\draw (0,0) circle (1cm);
\end{tikzpicture}
\end{document}


When I run my code, the smaller graphic is placed at the origin, according to the original coordinates which is obviously not what I want. Here's a picture of the resulting graphic: So I am wondering if there is a way to displace and possibly rescale it, so that I move it around to the empty space?

• I think that you can use the anchor key. See pag.369 of PGFplots manual. – vi pa Sep 20 '18 at 9:25
• You can place the code for the smaller graphic in a scope with a shift=<coordinate> option. – Max Sep 20 '18 at 9:26
• Welcome to TeX.SX! – Bobyandbob Sep 20 '18 at 10:23

As mentioned in the comments, the scope environment lets you move things around, and rescale:

\documentclass[crop,tikz]{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}[scale=3]
\begin{axis}[]
(2,-2.8559703)
(3,-3.5301677)
(4,-4.3050655)
(5,-5.1413136)
(6,-6.0322865)
(7,-6.9675052)
(8,-7.9377747)
};
\end{axis}

% The code for the second smaller graphic starts here
\begin{scope}[shift={(2,1.5)},scale=1.33]
%axes
\draw  [ ->] (0,-0.1) -- (0,1.1);
\draw  [ ->] (-1.1,0) -- (1.1,0);
%The two vectors
\draw [dotted] [ ->] [line width=0.2mm] (0,0) -- (0.707,0.707);
\draw [dotted] [ ->] [line width=0.2mm] (0,0) -- (-0.65,0.375);
%the semicricle
\clip (-1.2,0) rectangle (1.,1.);
\draw (0,0) circle (1cm);
\end{scope}
\end{tikzpicture}
\end{document}


This produces the following: