\documentclass{article} \usepackage{tikz} \usepackage{verbatim} \begin{comment} :Title: Intersecting lines :Tags: Axes, Basics, Coordinate systems An example of using the intersection coordinate systems. Both the ``intersection`` and ``perpendicular`` coordinate system are used. The latter is a special case of the former, but has the shorter and more convenient ``-|`` and ``|-`` syntax. \end{comment} \begin{document} \begin{tikzpicture}[scale=1.5, >=stealth] % Zeichne Grid %\draw[step=0.1, color=lightgray] (-1,-1) grid(4,3.5); % Draw axes \draw [<->] (0,3) node (yaxis) [above] {$y$}|- (3,0) node (xaxis) [right] {$x$}; \draw [color=red](0,0) -- +(2.5,2.5); \draw plot[only marks, mark=x, mark options={blue}] coordinates{(2.5,2.5)} node[above, color=blue] {Punkt $(a_1,a_2)$}; \foreach \y in {0,1,2} \draw (1pt,\y cm) -- (-1pt,\y cm) node[anchor=east] {$\y$}; \foreach \x in {0,1,2} \draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor=north] {$\x$}; %\draw [color=green] (2.4,2.4) -- +(2.6,2.6) node[right] {Punkt $(a_1,a_2)$}; % \draw [color=blue](0,3) coordinate (a_1) -- (2,2) coordinate (a_2); % Draw two intersecting lines \draw [color=green, dashed] (-0.1,2.5) -- (2.5,2.5); \draw [color=green, dashed] (2.5,-0.1) -- (2.5,2.5); \node[green] at (-0.25,2.5) {$a_2$}; \node[green] at (2.5,-0.25) {$a_1$}; \node[right] at (0.05,2.2) {\tiny{2. Koordinate}}; \node[right] at (1,-0.4) {\tiny{1. Koordinate}}; % Calculate the intersection of the lines a_1 -- a_2 and b_1 -- b_2 % and store the coordinate in c. % \coordinate (c) at (intersection of a_1--a_2 and b_1--b_2); % Draw lines indicating intersection with y and x axis. Here we use % the perpendicular coordinate system % \draw[dashed] (yaxis |- c) node[left] {$y'$} % -| (xaxis -| c) node[below] {$x'$}; % Draw a dot to indicate intersection point % \fill[red] (c) circle (2pt); \end{tikzpicture} \end{document}