It is simply due to a forgotten square root step. It can be solved by adding `sqrt`

.

```
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=3]
\node[left] (O) at (0,0) {$O$};
%Draw the Circle around it all
\draw[semithick] (0,0) circle (1);
%Draw lines to the top
\foreach \x in {-4,...,4}
\draw[red,very thick] (\x/8,0) -- +(0,{sqrt(1-\x/8*\x/8)});
\end{tikzpicture}
\end{document}
```

As is explained in How do I draw shapes inside a tikz node? `pics`

can be used for defining new objects. My main problem using pics is how to place where you want because they aren't `nodes`

and positioning them is not so easy.

Following code shows how to define `EDFA`

block.

```
EDFA/.pic={
\begin{scope}[scale=.5]
\draw (-1,0) coordinate (in) -- (-1,1) -- (1,0) coordinate (out) -- (-1,-1) -- cycle;
\node[anchor=north,inner sep=2pt] at (0,-1) {$1$};
\end{scope}
```

In this case, coordinate (-1,0) will act as `west`

anchor and `1,0`

as east. Both point will have an special name for further reference. Every `pic`

is placed according its own origin `(0,0)`

. You can use Claudio's answer to Anchoring TiKZ pics for better positioning.

As your example was simple, I'd prefer to star with `EDFA`

and place `Source`

and `Sink`

after it.

```
\documentclass[]{article}
% tikz
\usepackage{tikz}
\usetikzlibrary{positioning} %relative positioning
\begin{document}
\tikzset{%
EDFA/.pic={
\begin{scope}[scale=.5]
\draw (-1,0) coordinate (in) -- (-1,1) -- (1,0) coordinate (out) -- (-1,-1) -- cycle;
\node[anchor=north,inner sep=2pt] at (0,-1) {$1$};
\end{scope}
}
}
\begin{tikzpicture}[
block/.style={draw},
]
\draw pic (edfa) {EDFA};
\node[block, left=of edfain] (source) {Source};
\node[block, right= of edfaout] (sink) {Sink};
\draw[->] (source) -- (edfain);
\draw[->] (edfaout) -- (sink);
\end{tikzpicture}
\end{document}
```

I understand that your components are more complex than `EDFA`

because for this particular case an `isosceles triangle`

node with a `label`

will do the work and it can be used as a `node`

and not as a `pic`

:

```
\documentclass[]{article}
% tikz
\usepackage{tikz}
\usetikzlibrary{positioning} %relative positioning
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}[
block/.style={draw},
edfa/.style={isosceles triangle, minimum width=1cm,
draw, anchor=west, isosceles triangle stretches,
minimum height=1cm, label=-80:#1}
]
\node[block] (source) {Source};
\node[edfa=1, right=of source] (edfa) {};
\node[block, right= of edfa] (sink) {Sink};
\draw[->] (source) -- (edfa);
\draw[->] (edfa) -- (sink);
\end{tikzpicture}
\end{document}
```

## Best Answer

You can set the units length in TikZ for X, Y and even Z coordinates independently using the

`x`

,`y`

and`z`

keys:See the

`pgfmanual`

p.249 section 22.2The XY- and XYZ-Coordinate Systems.Note that TikZ actually doesn't have unit length, but uses vectors. The above keys therefore also accept

`(a,b)`

coordinates (which must be enclosed in`{ }`

to hide the`,`

). The X and Y unit vectors do not need to be orthogonal to each other. The above code is the short version of`[x={(2cm,0cm)},y={(0cm,1.5cm)}]`

.You can also use the mentioned option

`scale`

as well, but I would prefer the above options. One difference will be that coordinates with explicit units are scaled as well with`scale`

. For example`(2cm,2)`

will be 3cm in both directions when`scale=1.5`

is set, but`(2cm,3cm)`

with`x=1.5cm,y=1.5cm`

.One problem with the use of vectors is that you can't access the effective unit length even for the default setup of an XY (no Z) orthogonal coordinate system. I personally needed that for my

`tikz-timing`

package. You need to use PGF code for this:`\pgfpointxy{1}{1}`

will give you the X and Y unit length as`\pgf@x`

and`\pgf@y`

. But note that these length registers will be overwritten by the next PGF or TikZ command.