A LaTeX Course.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lecture-05-TiKZ.tex 30KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074
  1. \documentclass{latexkurs}
  2. \subtitle{Grafiken erstellen mit \LaTeX{}}
  3. \date{2015-12-14}
  4. \def\TikZ{Ti\emph{k}Z}
  5. %%%%%%
  6. \begin{document}
  7. \begin{frame}
  8. \frametitle{Grafiken erstellen in \LaTeX}
  9. \onslide<+->
  10. \LaTeX\ stellt von sich aus Möglichkeiten bereit, Graphiken zu erzeugen:
  11. \begin{itemize}
  12. \item<2-> die \texttt{picture}-Umgebung
  13. \item<2-> \texttt{pict2e}, um die \texttt{picture}-Umgebung zu erweitern
  14. \item<2-> \texttt{epic}, \textit{enhanced picture}
  15. \item<2-> \texttt{eepic}, \textit{enhanced epic}
  16. \item<2-> \texttt{pmgraph}, \textit{poor man graphics}
  17. \item<3-> \alert<3-5>{pstricks}
  18. \begin{itemize}
  19. \item<4-> schnell (nutzt Postscript)
  20. \item<5-> funktioniert nicht mit \texttt{pdftex} und \texttt{luatex}
  21. \end{itemize}
  22. \item<6-> \alert<6->{\TikZ}
  23. \begin{itemize}
  24. \item<7-> portabel
  25. \item<8-> langsamer als \texttt{pstricks}
  26. \item<9-> subjektiv einfacher als \texttt{pstricks}
  27. \end{itemize}
  28. \end{itemize}
  29. \end{frame}
  30. \begin{luacode}
  31. function weierstrass(x0, x1, n, a, b, epsilon)
  32. local dx = (x1 - x0) / n
  33. local x = x0
  34. local out = assert(io.open("tmp.data", "w"))
  35. local y, k, dy
  36. while (x <= x1) do
  37. y = 0
  38. k = 0
  39. repeat
  40. dy = math.pow(a, k) * math.cos(math.pow(b, k) * math.pi * x)
  41. y = y + dy
  42. k = k + 1
  43. until (math.abs(dy) < epsilon)
  44. out:write(x, " ", y, "\string\n")
  45. x = x + dx
  46. end
  47. out:close()
  48. end
  49. \end{luacode}
  50. \directlua{weierstrass(-2,2,500,0.3,5,1.e-12)}
  51. \begin{frame}
  52. \frametitle{Weierstraß-Funktion mit \TikZ\ und Lua}
  53. \begin{equation*}
  54. x \mapsto \sum_{n=0} ^\infty a^n \cos(b^n \pi x)
  55. \end{equation*}
  56. \begin{center}
  57. \begin{tikzpicture}
  58. \begin{axis}[axis lines=middle, ymin=-1.5, ymax=1.75]
  59. \addplot[thin, blue] table {tmp.data};
  60. \end{axis}
  61. \end{tikzpicture}
  62. \end{center}
  63. \end{frame}
  64. \section{Grundlagen von \TikZ}
  65. \begin{frame}[fragile]
  66. \frametitle{Wie? }
  67. \onslide<+->
  68. Um \TikZ\ in \LaTeX\ zu nutzen:
  69. \begin{itemize}
  70. \item<+-> \lstinline!\usepackage{tikz}!
  71. \item<+-> Aller Code zwischen \lstinline!\begin{tikzpicture}! und
  72. \lstinline!\end{tikzpicture}! wird von \LaTeX\ an \TikZ\
  73. abgegeben.
  74. \end{itemize}
  75. \onslide<+->
  76. \begin{block}{\textcolor{red}{\textbf{ACHTUNG!}}}
  77. \TikZ\ ist eine eigene \enquote{Sprache}!
  78. \end{block}
  79. \end{frame}
  80. \begin{frame}[fragile,t]
  81. \frametitle{Die \texttt{tikzpicture} Umgebung.}
  82. \begin{lstlisting}
  83. \begin{tikzpicture}
  84. CODE
  85. \end{tikzpicture}
  86. \end{lstlisting}
  87. \pause
  88. Kann zum Beispiel in \texttt{figure} Umgebung eingebettet werden.
  89. \begin{lstlisting}
  90. \begin{figure}[h]
  91. \centering
  92. \begin{tikzpicture}
  93. CODE
  94. \end{tikzpicture}
  95. \caption{some caption}
  96. \label{fig:someref}
  97. \end{figure}
  98. \end{lstlisting}
  99. \end{frame}
  100. \begin{frame}[fragile]
  101. \frametitle{Let's draw some lines.}
  102. \centering
  103. \pause
  104. \begin{columns}
  105. \begin{column}{0.3\linewidth}
  106. \centering
  107. \tikzexternalenable
  108. \begin{tikzpicture}[step=0.3]
  109. \draw<2->[red] (0,0) -- (2,3);
  110. \draw<3->[thick,blue] (1,1) -- (1,3);
  111. \uncover<4->{\draw[step=0.3] (0,0) grid (3,3);}
  112. \end{tikzpicture}
  113. \tikzexternaldisable
  114. \end{column}
  115. \begin{column}{0.7\linewidth}
  116. \begin{lstlisting}[frame=none]
  117. \begin{tikzpicture}
  118. \draw[red] (0,0) -- (2,3); (*@\pause @*)
  119. \draw[thick,blue] (1,1) -- (1,3); (*@\pause @*)
  120. \draw[step=.3] (0,0) grid (3,3);
  121. \end{tikzpicture}
  122. \end{lstlisting}
  123. \end{column}
  124. \end{columns}
  125. \pause
  126. \medskip
  127. \begin{columns}
  128. \begin{column}{0.3\linewidth}
  129. \centering
  130. \tikzexternalenable
  131. \begin{tikzpicture}[step=0.3]
  132. \draw<5->[red,->] (0,0) -- (2,3);
  133. \draw<6->[blue,dashed] (1,1) -- (1,3);
  134. \uncover<7->{\draw[dotted] (0,0) grid (3,3);}
  135. \end{tikzpicture}
  136. \tikzexternaldisable
  137. \end{column}
  138. \begin{column}{0.7\linewidth}
  139. \begin{lstlisting}[frame=none]
  140. \begin{tikzpicture}[step=0.3]
  141. \draw[red,->] (0,0) -- (2,3); (*@\pause @*)
  142. \draw[blue,dashed] (1,1) -- (1,3); (*@\pause @*)
  143. \draw[dotted] (0,0) grid (3,3);
  144. \end{tikzpicture}
  145. \end{lstlisting}
  146. \end{column}
  147. \end{columns}
  148. \end{frame}
  149. \begin{frame}[fragile,t]
  150. \frametitle{Even more lines.}
  151. \pause
  152. \begin{columns}
  153. \begin{column}{0.3\linewidth}
  154. \centering
  155. \tikzexternalenable
  156. \begin{tikzpicture}[step=0.4,scale=0.8]
  157. \uncover<2->{\draw[red!50,thick,<<-] (0,0) -- (2,3);}
  158. \draw<3->[line width=4pt,blue] (1,1) -- (0,2);
  159. \uncover<4->{\draw[dotted] (0,0) grid (3,3);}
  160. \end{tikzpicture}
  161. \tikzexternaldisable
  162. \end{column}
  163. \begin{column}{0.7\linewidth}
  164. \begin{lstlisting}[frame=none]
  165. \begin{tikzpicture}[scale=0.8,step=0.4]
  166. \draw[red!50,thick,<<-] (0,0) -- (2,3); (*@\pause @*)
  167. \draw[line width=4pt,blue] (1,1) -- (0,2); (*@\pause @*)
  168. \draw[dotted] (0,0) grid (3,3);
  169. \end{tikzpicture}
  170. \end{lstlisting}
  171. \end{column}
  172. \end{columns}
  173. \pause
  174. \medskip
  175. \begin{columns}
  176. \begin{column}{0.3\linewidth}
  177. \centering
  178. \tikzexternalenable
  179. \begin{tikzpicture}[every node/.style={below}]
  180. \tikzset{step=0.3}
  181. \draw<5->[red] (0,0) -- (2,3) node[above] {a};
  182. \draw<6->[blue,dashed] (1,1) rectangle (2,2);
  183. \uncover<7->{\draw[dotted] (0,0) node {0} grid (3,3);}
  184. \draw<8->[fill,,opacity=0.3] (1,1) circle(.707);
  185. \end{tikzpicture}
  186. \tikzexternaldisable
  187. \end{column}
  188. \begin{column}{0.7\linewidth}
  189. \begin{lstlisting}[frame=none]
  190. \begin{tikzpicture}[step=0.3]
  191. \tikzset{every node/.style={below}}
  192. \draw[red] (0,0) -- (2,3) node[above] {a}; (*@\pause @*)
  193. \draw[blue,dashed] (1,1) rectangle (2,2); (*@\pause @*)
  194. \draw[dotted] (0,0) node {0} grid (3,3); (*@\pause @*)
  195. \draw[fill,opacity=0.3] (1,1) circle(1);
  196. \end{tikzpicture}
  197. \end{lstlisting}
  198. \end{column}
  199. \end{columns}
  200. \end{frame}
  201. \begin{frame}[fragile]
  202. \frametitle{Let's get curvy}
  203. \pause
  204. \begin{columns}
  205. \begin{column}{0.3\linewidth}
  206. \centering
  207. \tikzexternalenable
  208. \begin{tikzpicture}
  209. \coordinate (a) at (0,0);
  210. \coordinate (b) at (0,1);
  211. \coordinate (c) at (1,1);
  212. \coordinate (d) at (3,2);
  213. \draw[blue] (a) -- (d);
  214. \draw<2-> (a)..controls (b) and (c)..(d);
  215. \draw<3->[green,bend left=30] (a) to (d);
  216. \draw<4->[red,out=90, in=-90] (a) to (d);
  217. \draw<5-> ($(a)!0.5!(d)$) ellipse (1 and 0.5);
  218. \end{tikzpicture}
  219. \tikzexternaldisable
  220. \end{column}
  221. \begin{column}{0.7\linewidth}
  222. \begin{lstlisting}[mathescape=false,frame=none]
  223. \usetikzlibrary{calc}
  224. \begin{tikzpicture}
  225. \coordinate (a) at (0,0);
  226. \coordinate (b) at (0,1);
  227. \coordinate (c) at (1,1);
  228. \coordinate (d) at (3,2);
  229. \draw[blue] (a) -- (d);
  230. \draw (a)..controls (b) and (c)..(d); (*@\pause @*)
  231. \draw[green,bend left=30] (a) to (d); (*@\pause @*)
  232. \draw[red,out=90, in=-90] (a) to (d); (*@\pause @*)
  233. \draw ($(a)!0.5!(d)$) ellipse(1 and 0.5);
  234. \end{tikzpicture}
  235. \end{lstlisting}
  236. \end{column}
  237. \end{columns}
  238. \end{frame}
  239. \begin{frame}[fragile]
  240. \frametitle{Zickzack}
  241. \pause
  242. \begin{columns}
  243. \begin{column}{0.3\linewidth}
  244. \centering
  245. \begin{tikzpicture}
  246. \coordinate (a) at (0,0);
  247. \coordinate (b) at (1,1);
  248. \coordinate (c) at (3,2);
  249. \draw<2->[blue] (a) -- (c);
  250. \draw<3-> (a)--(b)--(c);
  251. \begin{scope}[yshift=1cm,dashed,thick]
  252. \coordinate (a) at (0,0);
  253. \coordinate (c) at (3,2);
  254. \uncover<6->{\draw[red] (a)--(b)--(c);}
  255. \node<7->[draw,circle through=(a)] at (b){};
  256. \end{scope}
  257. \end{tikzpicture}
  258. \end{column}
  259. \begin{column}{0.7\linewidth}
  260. \begin{lstlisting}[mathescape=false,frame=none]
  261. \usetikzlibrary{through}
  262. \begin{tikzpicture}
  263. \coordinate (a) at (0,0);
  264. \coordinate (b) at (1,1);
  265. \coordinate (c) at (3,2);
  266. \draw[blue] (a) -- (c);(*@\pause @*)
  267. \draw (a)--(b)--(c);(*@\pause @*)
  268. \begin{scope}[yshift=1cm,dashed,thick] (*@\pause @*)
  269. \coordinate (a) at (0,0);
  270. \coordinate (c) at (3,2);(*@\pause @*)
  271. \draw[red] (a)--(b)--(c);(*@\pause @*)
  272. \node[(*@draw@*),circle through=(a)] at (b){};
  273. \end{scope}
  274. \end{tikzpicture}
  275. \end{lstlisting}
  276. \end{column}
  277. \end{columns}
  278. \end{frame}
  279. \begin{frame}[fragile]
  280. \frametitle{Eine andere Sicht.}
  281. \pause
  282. \begin{columns}
  283. \begin{column}{0.2\linewidth}
  284. \centering
  285. \begin{tikzpicture}
  286. \tikzset{tomsbox/.style={rectangle, draw, very thick,
  287. minimum size=7mm, rounded corners=2mm}}
  288. \node[tomsbox] (1) at (0,0) {$T_1$};
  289. \node[tomsbox] (2) [below=of 1] {$T_2$};
  290. \node[tomsbox] (3) [below=of 2] {$T_3$};
  291. \node[tomsbox] (4) [below=of 3] {$T_4$};
  292. \draw (1)--(2)--(3)--(4);
  293. \end{tikzpicture}
  294. \end{column}
  295. \begin{column}{0.8\linewidth}
  296. \begin{lstlisting}[mathescape=false,frame=none]
  297. \usetikzlibrary{positioning} % in der Präambel
  298. \begin{tikzpicture}
  299. \tikzset{tomsbox/.style={rectangle, (*@draw@*),
  300. very thick,minimum size=7mm,
  301. rounded corners=2mm}}
  302. \node[tomsbox] (1) at (0,0) {$T_1$};
  303. \node[tomsbox] (2) [below=of 1] {$T_2$};
  304. \node[tomsbox] (3) [below=of 2] {$T_3$};
  305. \node[tomsbox] (4) [below=of 3] {$T_4$};
  306. \draw (1)--(2)--(3)--(4);
  307. \end{tikzpicture}
  308. \end{lstlisting}
  309. \end{column}
  310. \end{columns}
  311. \end{frame}
  312. \begin{frame}[fragile]
  313. \frametitle{for many times}
  314. \pause
  315. \begin{columns}
  316. \begin{column}{0.2\linewidth}
  317. \centering
  318. \begin{tikzpicture}
  319. \tikzset{tomsbox/.style={rectangle, draw, very thick,
  320. minimum size=7mm, rounded corners=2mm}}
  321. \node[tomsbox] (1) at (0,0) {$T_1$};
  322. \foreach \i [count=\j] in {2,3,4}{
  323. \node[tomsbox] (\i) [below=of \j] {$T_\i$};
  324. \draw (\j)--(\i);
  325. }
  326. \end{tikzpicture}
  327. \end{column}
  328. \begin{column}{0.82\linewidth}
  329. \begin{lstlisting}[mathescape=false,frame=none]
  330. \begin{tikzpicture}
  331. \tikzset{tomsbox/.style={rectangle, (*@draw@*),
  332. very thick,minimum size=7mm,
  333. rounded corners=2mm}}
  334. \node[tomsbox] (1) at (0,0) {$T_1$};
  335. \foreach \i [count=\j] in {2,3,4}
  336. {
  337. \node[tomsbox] (\i) [below=of \j] {$T_\i$};
  338. \draw (\j)--(\i);
  339. }
  340. \end{tikzpicture}
  341. \end{lstlisting}
  342. \end{column}
  343. \end{columns}
  344. \end{frame}
  345. \begin{frame}[fragile]
  346. \frametitle{Bibliotheken}
  347. \onslide<+->
  348. Die Funktionalität von \TikZ\ kann durch externe \emph{Bibliotheken} erweitert werden.
  349. \onslide<+->
  350. \begin{Beispiel}
  351. \begin{lstlisting}
  352. \usetikzlibrary{automata}
  353. \end{lstlisting}
  354. \centering
  355. \begin{tikzpicture}[shorten >=1pt,node distance=1cm and 3cm,on grid,
  356. every state/.style={draw=blue!50,very thick,fill=blue!20}]
  357. \node[state,initial] (q_0) {$q_0$};
  358. \node[state] (q_1) [above right=of q_0] {$q_1$};
  359. \node[state] (q_2) [below right=of q_0] {$q_2$};
  360. \path[->] (q_0) edge node [above left] {0} (q_1)
  361. edge node [below left] {1} (q_2)
  362. (q_1) edge [loop above] node {0} ()
  363. (q_2) edge [loop below] node {1} ();
  364. \end{tikzpicture}
  365. \end{Beispiel}
  366. \end{frame}
  367. \begin{frame}
  368. \frametitle{Bibliotheken}
  369. \onslide<+->
  370. \texttt{3d},
  371. \texttt{angles},
  372. \texttt{arrows},
  373. \texttt{automata},
  374. \texttt{babel},
  375. \texttt{backgrounds},
  376. \texttt{bending},
  377. \texttt{calc},
  378. \texttt{calendar},
  379. \texttt{chains},
  380. \texttt{decorations},
  381. \texttt{decorations.footprints},
  382. \texttt{decorations.fractals},
  383. \texttt{decorations.markings},
  384. \texttt{decorations.pathmorphing},
  385. \texttt{decorations.pathreplacing},
  386. \texttt{decorations.shapes},
  387. \texttt{decorations.text},
  388. \texttt{er},
  389. \texttt{fadings},
  390. \texttt{fit},
  391. \texttt{fixedpointarithmetic},
  392. \texttt{folding},
  393. \texttt{fpu},
  394. \texttt{intersections},
  395. \texttt{lindenmayersystems},
  396. \texttt{math},
  397. \texttt{matrix},
  398. \texttt{mindmap},
  399. \texttt{patterns},
  400. \texttt{petri},
  401. \texttt{plothandlers},
  402. \texttt{plotmarks},
  403. \texttt{positioning},
  404. \texttt{quotes},
  405. \texttt{scopes},
  406. \texttt{shadings},
  407. \texttt{shadows},
  408. \texttt{shapes.arrows},
  409. \texttt{shapes.callouts},
  410. \texttt{shapes},
  411. \texttt{shapes.gates.logic.IEC},
  412. \texttt{shapes.gates.logic.US},
  413. \texttt{shapes.geometric},
  414. \texttt{shapes.misc},
  415. \texttt{shapes.multipart},
  416. \texttt{shapes.symbols},
  417. \texttt{snakes},
  418. \texttt{spy},
  419. \texttt{svg.path},
  420. \texttt{through},
  421. \texttt{topaths},
  422. \texttt{trees},
  423. \texttt{turtle}
  424. \end{frame}
  425. \section{Datenvisualisierung}
  426. \begin{frame}[fragile]
  427. \frametitle{Datenvisualisierung}
  428. \onslide<+->
  429. \begin{columns}
  430. \begin{column}{0.3\linewidth}
  431. \centering
  432. \begin{tikzpicture}
  433. \datavisualization [school book axes, visualize as smooth line]
  434. data {x, y
  435. -1.5, 2.25
  436. -1, 1
  437. -.5, .25
  438. 0, 0
  439. .5, .25
  440. 1, 1
  441. 1.5, 2.25
  442. };
  443. \end{tikzpicture}
  444. \end{column}
  445. \begin{column}{0.6\linewidth}
  446. \small
  447. \begin{lstlisting}[frame=none]
  448. \usetikzlibrary{datavisualization}
  449. \begin{tikzpicture}
  450. \datavisualization [school book axes,
  451. visualize as smooth line]
  452. data {x, y
  453. -1.5, 2.25
  454. -1, 1
  455. -.5, .25
  456. 0, 0
  457. .5, .25
  458. 1, 1
  459. 1.5, 2.25
  460. };
  461. \end{tikzpicture}
  462. \end{lstlisting}
  463. \end{column}
  464. \end{columns}
  465. \end{frame}
  466. \begin{frame}[fragile]
  467. \frametitle{Automatisch}
  468. \onslide<+->
  469. \begin{columns}
  470. \begin{column}{0.3\linewidth}
  471. \centering
  472. \begin{tikzpicture}[baseline]
  473. \datavisualization [school book axes,
  474. visualize as smooth line]
  475. data [format=function] {
  476. var x : interval [-1.5:1.5] samples 7;
  477. func y = \value x * \value x;
  478. };
  479. \end{tikzpicture}
  480. \end{column}
  481. \begin{column}{0.6\linewidth}
  482. \small
  483. \begin{lstlisting}[mathescape=false,frame=none]
  484. \usetikzlibrary{(*@datavisualization@*),
  485. (*@datavisualization@*).formats.functions}
  486. \begin{tikzpicture}
  487. \datavisualization
  488. [school book axes,
  489. visualize as smooth line]
  490. data [format=function] {
  491. var x : interval [-1.5:1.5]
  492. samples 7;
  493. func y = \value x * \value x;
  494. };
  495. \end{tikzpicture}
  496. \end{lstlisting}
  497. \end{column}
  498. \end{columns}
  499. \end{frame}
  500. \begin{frame}[fragile]
  501. \frametitle{Achsen}
  502. \onslide<+->
  503. \begin{columns}
  504. \begin{column}{0.3\linewidth}
  505. \centering
  506. \begin{tikzpicture}[baseline]
  507. \datavisualization [scientific axes=clean,
  508. x axis={length=.7\linewidth, ticks=few},
  509. visualize as smooth line]
  510. data [format=function] {
  511. var x : interval [-1.5:1.5] samples 7;
  512. func y = \value x * \value x;
  513. };
  514. \end{tikzpicture}
  515. \end{column}
  516. \begin{column}{0.6\linewidth}
  517. \small
  518. \begin{lstlisting}[mathescape=false,frame=none]
  519. \begin{tikzpicture}
  520. \datavisualization
  521. [scientific axes=clean,
  522. x axis={length=.7\linewidth,
  523. ticks=few},
  524. visualize as smooth line]
  525. data [format=function] {
  526. var x : interval [-1.5:1.5]
  527. samples 7;
  528. func y = \value x * \value x;
  529. };
  530. \end{tikzpicture}
  531. \end{lstlisting}
  532. \end{column}
  533. \end{columns}
  534. \end{frame}
  535. \begin{frame}[fragile]
  536. \frametitle{Darstellung}
  537. \onslide<+->
  538. \begin{columns}
  539. \begin{column}{0.3\linewidth}
  540. \centering
  541. \begin{tikzpicture}[baseline]
  542. \datavisualization [scientific axes=clean,
  543. x axis={length=.7\linewidth, ticks=few},
  544. visualize as scatter]
  545. data [format=function] {
  546. var x : interval [-1.5:1.5] samples 7;
  547. func y = \value x * \value x;
  548. };
  549. \end{tikzpicture}
  550. \end{column}
  551. \begin{column}{0.6\linewidth}
  552. \small
  553. \begin{lstlisting}[mathescape=false,frame=none]
  554. \begin{tikzpicture}
  555. \datavisualization
  556. [scientific axes=clean,
  557. x axis={length=.7\linewidth,
  558. ticks=few},
  559. visualize as scatter]
  560. data [format=function] {
  561. var x : interval [-1.5:1.5]
  562. samples 7;
  563. func y = \value x * \value x;
  564. };
  565. \end{tikzpicture}
  566. \end{lstlisting}
  567. \end{column}
  568. \end{columns}
  569. \end{frame}
  570. \begin{frame}[fragile]
  571. \frametitle{Legenden}
  572. \onslide<+->
  573. \begin{columns}
  574. \begin{column}{0.3\linewidth}
  575. \centering
  576. \begin{tikzpicture}[baseline]
  577. \datavisualization [scientific axes=clean,
  578. x axis={length=.7\linewidth, ticks=few},
  579. legend={below},
  580. visualize as smooth line/.list={square},
  581. square={label in legend={text=$x^2$}}]
  582. data [format=function,set=square] {
  583. var x : interval [-1.5:1.5] samples 7;
  584. func y = \value x * \value x;
  585. };
  586. \end{tikzpicture}
  587. \end{column}
  588. \begin{column}{0.6\linewidth}
  589. \small
  590. \begin{lstlisting}[mathescape=false,frame=none]
  591. \begin{tikzpicture}
  592. \datavisualization
  593. [scientific axes=clean,
  594. x axis={length=.7\linewidth,
  595. ticks=few},
  596. legend={below},
  597. visualize as smooth
  598. line/.list={sq},
  599. sq={label in legend={text=$x^2$}}]
  600. data [format=function,set=sq] {
  601. var x : interval [-1.5:1.5]
  602. samples 7;
  603. func y = \value x * \value x;
  604. };
  605. \end{tikzpicture}
  606. \end{lstlisting}
  607. \end{column}
  608. \end{columns}
  609. \end{frame}
  610. \section{Ein Tutorial}
  611. \begin{frame}[t]
  612. \begin{block}{Ziel}
  613. \begin{center}
  614. \begin{tikzpicture}[
  615. thick,
  616. >=stealth',
  617. dot/.style = {
  618. draw,
  619. fill = white,
  620. circle,
  621. inner sep = 0pt,
  622. minimum size = 4pt
  623. }
  624. ]
  625. \coordinate (O) at (0,0);
  626. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  627. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  628. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  629. \path[name path=y] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  630. \begin{scope}[name intersections = {of = x and y, name = i}]
  631. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  632. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  633. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  634. \draw (i-1) node[dot, label = {above:$P$}] (i-1) {} -- node[left,yshift=-3pt]
  635. {$f(x_0)$} (i-1 |- O) node[dot, label = {below:$x_0$}] {};
  636. \path (i-2) node[dot, label = {above:$Q$}] (i-2) {} -- (i-2 |- i-1)
  637. node[dot] (i-12) {};
  638. \draw (i-12) -- (i-12 |- O) node[dot,
  639. label = {below:$x_0 + \varepsilon$}] {};
  640. \draw[blue, <->] (i-2) -- node[right] {$f(x_0 + \varepsilon) - f(x_0)$}
  641. (i-12);
  642. \draw[blue, <->] (i-1) -- node[below] {$\varepsilon$} (i-12);
  643. \path (i-1 |- O) -- node[below] {$\varepsilon$} (i-2 |- O);
  644. \draw[gray] (i-2) -- (i-2 -| xmax);
  645. \draw[gray, <->] ([xshift = -0.5cm]i-2 -| xmax) -- node[fill = white]
  646. {$f(x_0 + \varepsilon)$} ([xshift = -0.5cm]xmax);
  647. \end{scope}
  648. \end{tikzpicture}
  649. \end{center}
  650. \end{block}
  651. \end{frame}
  652. \begin{frame}[t,fragile]
  653. \onslide<+->
  654. \begin{center}
  655. \scalebox{0.6}[0.6]{
  656. \begin{tikzpicture}
  657. \coordinate (O) at (0,0); \draw[->] (-0.3,0) -- (8,0) coordinate[label =
  658. {below:$x$}] (xmax); \draw[->] (0,-0.3) -- (0,5) coordinate[label =
  659. {right:$f(x)$}] (ymax);
  660. \end{tikzpicture}
  661. }
  662. \end{center}
  663. \small
  664. \begin{lstlisting}
  665. \coordinate (O) at (0,0);
  666. \draw[->] (-0.3,0) -- (8,0) (*@coordinate@*)[label = {below:$x$}] (xmax);
  667. \draw[->] (0,-0.3) -- (0,5) (*@coordinate@*)[label = {right:$f(x)$}] (ymax);
  668. \end{lstlisting}
  669. \end{frame}
  670. \begin{frame}[t,fragile]
  671. \begin{center}
  672. \scalebox{0.6}[0.6]{
  673. \begin{tikzpicture}
  674. \coordinate (O) at (0,0);
  675. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  676. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  677. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  678. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  679. \end{tikzpicture}
  680. }
  681. \end{center}
  682. \small
  683. \begin{lstlisting}
  684. \draw (0.3,0.5) -- (6.7,4.7) (*@node@*)[pos=0.8, below right] {Sekante};
  685. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  686. \end{lstlisting}
  687. \end{frame}
  688. \begin{frame}[t,fragile]
  689. \onslide<+->
  690. \begin{center}
  691. \scalebox{0.6}[0.6]{
  692. \begin{tikzpicture}
  693. \coordinate (O) at (0,0);
  694. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  695. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  696. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  697. \path[name path=y] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  698. \begin{scope}[name intersections = {of = x and y, name = i}]
  699. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  700. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  701. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  702. \end{scope}
  703. \end{tikzpicture}
  704. }
  705. \end{center}
  706. \small
  707. \begin{lstlisting}
  708. \path[name (*@path@*)=x] (0.3,0.5) -- (6.7,4.7);
  709. \path[name (*@path@*)=y] plot[smooth]
  710. coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  711. \begin{scope}[name intersections = {of = x and y, name = i}]
  712. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  713. \draw (0.3,0.5) -- (6.7,4.7) (*@node@*)[pos=0.8, below right] {Sekante};
  714. \draw[red] plot[smooth]
  715. coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  716. \end{scope}
  717. \end{lstlisting}
  718. \end{frame}
  719. \begin{frame}[t,fragile]
  720. \begin{center}
  721. \scalebox{0.6}[0.6]{
  722. \begin{tikzpicture}
  723. \coordinate (O) at (0,0);
  724. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  725. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  726. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  727. \path[name path=y] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  728. \begin{scope}[name intersections = {of = x and y, name = i}]
  729. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  730. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  731. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  732. \draw (i-1) node[label = {above:$P$}] {} -- node[left,yshift=-3pt]
  733. {$f(x_0)$} (i-1 |- O) node[label = {below:$x_0$}] {};
  734. \end{scope}
  735. \end{tikzpicture}
  736. }
  737. \end{center}
  738. \small
  739. \begin{lstlisting}
  740. \begin{scope}[name intersections = {$\dots$}]
  741. $\dots\quad (\textsl{Wie vorher})$
  742. \draw (i-1) (*@node@*)[label = {above:$\text{\$P\$}$}] {}
  743. -- (*@node@*)[left,yshift=-3pt] {$\text{\$f(x\_0)\$}$}
  744. (i-1 |- O) (*@node@*)[label = {below:$\text{\$x\_0\$}$}] {};
  745. \end{scope}
  746. \end{lstlisting}
  747. \end{frame}
  748. \begin{frame}[t,fragile]
  749. \onslide<+->
  750. \begin{center}
  751. \scalebox{0.6}[0.6]{
  752. \begin{tikzpicture}
  753. \coordinate (O) at (0,0);
  754. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  755. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  756. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  757. \path[name path=y] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  758. \begin{scope}[name intersections = {of = x and y, name = i}]
  759. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  760. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  761. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  762. \draw (i-1) node[label = {above:$P$}] {} -- node[left,yshift=-3pt]
  763. {$f(x_0)$} (i-1 |- O) node[label = {below:$x_0$}] {};
  764. \path (i-2) node[label = {above:$Q$}] {} -- (i-2 |- i-1) node (i-12) {};
  765. \end{scope}
  766. \end{tikzpicture}
  767. }
  768. \end{center}
  769. \small
  770. \begin{lstlisting}
  771. \begin{scope}[$\dots$]
  772. $\dots\quad (\textsl{Wie vorher})$
  773. \path (i-2) (*@node@*)[label = {above:$\text{\$Q\$}$}] {}
  774. -- (i-2 |- i-1) (*@node@*) (i-12) {};
  775. \end{scope}
  776. \end{lstlisting}
  777. \end{frame}
  778. \begin{frame}[t,fragile]
  779. \begin{center}
  780. \scalebox{0.6}[0.6]{
  781. \begin{tikzpicture}
  782. \coordinate (O) at (0,0);
  783. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  784. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  785. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  786. \path[name path=y] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  787. \begin{scope}[name intersections = {of = x and y, name = i}]
  788. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  789. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  790. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  791. \draw (i-1) node[label = {above:$P$}] {} -- node[left,yshift=-3pt]
  792. {$f(x_0)$} (i-1 |- O) node[label = {below:$x_0$}] {};
  793. \path (i-2) node[label = {above:$Q$}] {} -- (i-2 |- i-1) node (i-12) {};
  794. \draw (i-12) -- (i-12 |- O) node[label = {below:$x_0 + \varepsilon$}] {};
  795. \end{scope}
  796. \end{tikzpicture}
  797. }
  798. \end{center}
  799. \small
  800. \begin{lstlisting}
  801. \begin{scope}[$\dots$]
  802. $\dots\quad(\textsf{Wie vorher})$
  803. \draw (i-12) -- (i-12 |- O)
  804. (*@node@*)[label = {below:(*@\$@*)x_0 + \varepsilon(*@\$@*)}] {};
  805. \end{scope}
  806. \end{lstlisting}
  807. \end{frame}
  808. \begin{frame}[t,fragile]
  809. \begin{center}
  810. \scalebox{0.6}[0.6]{
  811. \begin{tikzpicture}
  812. \coordinate (O) at (0,0);
  813. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  814. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  815. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  816. \path[name path=y] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  817. \begin{scope}[name intersections = {of = x and y, name = i}]
  818. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  819. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  820. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  821. \draw (i-1) node[label = {above:$P$}] {} -- node[left,yshift=-3pt]
  822. {$f(x_0)$} (i-1 |- O) node[label = {below:$x_0$}] {};
  823. \path (i-2) node[label = {above:$Q$}] {} -- (i-2 |- i-1) node (i-12) {};
  824. \draw (i-12) -- (i-12 |- O) node[label = {below:$x_0 + \varepsilon$}] {};
  825. \draw[blue, <->] (i-2) -- node[right] {$f(x_0 + \varepsilon) - f(x_0)$} (i-12);
  826. \draw[blue, <->] (i-1) -- node[below] {$\varepsilon$} (i-12);
  827. \end{scope}
  828. \end{tikzpicture}
  829. }
  830. \end{center}
  831. \small
  832. \begin{lstlisting}
  833. \begin{scope}[$\dots$]
  834. $\dots\quad(\textsl{Wie vorher})$
  835. \draw[blue, <->] (i-2) --
  836. (*@node@*)[right] {(*@\$@*)f(x_0 + \varepsilon) - f(x_0)(*@\$@*)} (i-12);
  837. \draw[blue, <->] (i-1) --
  838. (*@node@*)[below] {(*@\$@*)\varepsilon(*@\$@*)} (i-12);
  839. \end{scope}
  840. \end{lstlisting}
  841. \end{frame}
  842. \begin{frame}[t,fragile]
  843. \begin{center}
  844. \scalebox{0.6}[0.6]{
  845. \begin{tikzpicture}
  846. \coordinate (O) at (0,0);
  847. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  848. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  849. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  850. \path[name path=y] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  851. \begin{scope}[name intersections = {of = x and y, name = i}]
  852. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  853. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  854. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  855. \draw (i-1) node[label = {above:$P$}] {} -- node[left,yshift=-3pt]
  856. {$f(x_0)$} (i-1 |- O) node[label = {below:$x_0$}] {};
  857. \path (i-2) node[label = {above:$Q$}] {} -- (i-2 |- i-1) node (i-12) {};
  858. \draw (i-12) -- (i-12 |- O) node[label = {below:$x_0 + \varepsilon$}] {};
  859. \draw[blue, <->] (i-2) -- node[right] {$f(x_0 + \varepsilon) - f(x_0)$} (i-12);
  860. \draw[blue, <->] (i-1) -- node[below] {$\varepsilon$} (i-12);
  861. \path (i-1 |- O) -- node[below] {$\varepsilon$} (i-2 |- O);
  862. \draw[gray] (i-2) -- (i-2 -| xmax);
  863. \draw[gray, <->] ([xshift = -0.5cm]i-2 -| xmax) -- node[fill = white]
  864. {$f(x_0 + \varepsilon)$} ([xshift = -0.5cm]xmax);
  865. \end{scope}
  866. \end{tikzpicture}
  867. }
  868. \end{center}
  869. \small
  870. \begin{lstlisting}
  871. \begin{scope}[$\dots$]
  872. $\dots\quad (\textsl{Wie vorher})$
  873. \path (i-1 |- O) --
  874. (*@node@*)[below] {(*@\$@*)\varepsilon(*@\$@*)} (i-2 |- O);
  875. \draw[gray] (i-2) -- (i-2 -| xmax);
  876. \draw[gray, <->] ([xshift = -0.5cm]i-2 -| xmax) --
  877. (*@node@*)[fill = white] {(*@\$@*)f(x_0 + \varepsilon)(*@\$@*)}
  878. ([xshift = -0.5cm]xmax);
  879. \end{scope}
  880. \end{lstlisting}
  881. \end{frame}
  882. \begin{frame}[t,fragile]
  883. \begin{center}
  884. \scalebox{0.6}[0.6]{
  885. \begin{tikzpicture}[
  886. thick,
  887. >=stealth',
  888. dot/.style = {
  889. draw,
  890. fill = white,
  891. circle,
  892. inner sep = 0pt,
  893. minimum size = 4pt
  894. }
  895. ]
  896. \coordinate (O) at (0,0);
  897. \draw[->] (-0.3,0) -- (8,0) coordinate[label = {below:$x$}] (xmax);
  898. \draw[->] (0,-0.3) -- (0,5) coordinate[label = {right:$f(x)$}] (ymax);
  899. \path[name path=x] (0.3,0.5) -- (6.7,4.7);
  900. \path[name path=y] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  901. \begin{scope}[name intersections = {of = x and y, name = i}]
  902. \fill[gray!20] (i-1) -- (i-2 |- i-1) -- (i-2) -- cycle;
  903. \draw (0.3,0.5) -- (6.7,4.7) node[pos=0.8, below right] {Sekante};
  904. \draw[red] plot[smooth] coordinates {(-0.3,2) (2,1.5) (4,2.8) (6,5)};
  905. \draw (i-1) node[dot, label = {above:$P$}] (i-1) {} -- node[left,yshift=-3pt]
  906. {$f(x_0)$} (i-1 |- O) node[dot, label = {below:$x_0$}] {};
  907. \path (i-2) node[dot, label = {above:$Q$}] (i-2) {} -- (i-2 |- i-1)
  908. node[dot] (i-12) {};
  909. \draw (i-12) -- (i-12 |- O) node[dot,
  910. label = {below:$x_0 + \varepsilon$}] {};
  911. \draw[blue, <->] (i-2) -- node[right] {$f(x_0 + \varepsilon) - f(x_0)$}
  912. (i-12);
  913. \draw[blue, <->] (i-1) -- node[below] {$\varepsilon$} (i-12);
  914. \path (i-1 |- O) -- node[below] {$\varepsilon$} (i-2 |- O);
  915. \draw[gray] (i-2) -- (i-2 -| xmax);
  916. \draw[gray, <->] ([xshift = -0.5cm]i-2 -| xmax) -- node[fill = white]
  917. {$f(x_0 + \varepsilon)$} ([xshift = -0.5cm]xmax);
  918. \end{scope}
  919. \end{tikzpicture}
  920. }
  921. \end{center}
  922. \small
  923. \begin{lstlisting}
  924. \begin{tikzpicture}[thick, >=stealth',
  925. dot/.style = {
  926. (*@draw@*),
  927. fill = white,
  928. circle,
  929. inner sep = 0pt,
  930. minimum size = 4pt
  931. }]
  932. $\dots$
  933. \end{lstlisting}
  934. \end{frame}
  935. \end{document}
  936. %%% Local Variables:
  937. %%% mode: latex
  938. %%% TeX-master: t
  939. %%% TeX-engine: luatex
  940. %%% End: