26.10.2014 Views

TikZ and pgf

TikZ and pgf

TikZ and pgf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

\begin{tikzpicture}[scale=3]<br />

\draw[step=.5cm,gray,very thin] (-1.4,-1.4) grid (1.4,1.4);<br />

\draw (-1.5,0) -- (1.5,0);<br />

\draw (0,-1.5) -- (0,1.5);<br />

\draw (0,0) circle (1cm);<br />

\draw (3mm,0mm) arc (0:30:3mm);<br />

\end{tikzpicture}<br />

As for circles, you can specify “two” radii in order to get an elliptical arc.<br />

\tikz \draw (0,0) arc (0:315:1.75cm <strong>and</strong> 1cm);<br />

3.11 Clipping a Path<br />

In order to save space in this manual, it would be nice to clip Karl’s graphics a bit so that we can focus on<br />

the “interesting” parts. Clipping is pretty easy in <strong>TikZ</strong>. You can use the \clip comm<strong>and</strong> clip all subsequent<br />

drawing. It works like \draw, only it does not draw anything, but uses the given path to clip everything<br />

subsequently.<br />

\begin{tikzpicture}[scale=3]<br />

\clip (-0.1,-0.2) rectangle (1.1,0.75);<br />

\draw[step=.5cm,gray,very thin] (-1.4,-1.4) grid (1.4,1.4);<br />

\draw (-1.5,0) -- (1.5,0);<br />

\draw (0,-1.5) -- (0,1.5);<br />

\draw (0,0) circle (1cm);<br />

\draw (3mm,0mm) arc (0:30:3mm);<br />

\end{tikzpicture}<br />

You can also do both at the same time: Draw <strong>and</strong> clip a path. For this, use the \draw comm<strong>and</strong> <strong>and</strong><br />

add the clip option. (This is not the whole picture: You can also use the \clip comm<strong>and</strong> <strong>and</strong> add the<br />

draw option. Well, that is also not the whole picture: In reality, \draw is just a shorth<strong>and</strong> for \path[draw]<br />

<strong>and</strong> \clip is a shorth<strong>and</strong> for \path[clip] <strong>and</strong> you could also say \path[draw,clip].) Here is an example:<br />

26

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!