[Tex/LaTex] Simple line with dots, known coordinates

asymptotediagramspstrickstikz-pgf

Are there any easy way to make something similar to this image in tikz, asympote or similar?

I know the coordinates, to each of the points =)

Simple numberline

The actuall numbers

Ofcourse I know how to solve this, but to do it in tikz or simmilar is new to me.

Best Answer

There is an easy way to do this in TikZ, with the \foreach statement. Like this:

\documentclass{article}
\usepackage{tikz}
\begin{document}
    \noindent
    \begin{tikzpicture}
        \path[draw, thick, ->] (-.3,0) -- (6.3,0);
        \foreach \x in {0,...,6}{
            \path[draw, thick] (\x,0) -- ++(0,-.15) node [below] {\x};
        }
        \foreach \x/\name in {0/A,.6/B,1/C,1.5/D,2/E,2.3/F,3/G,3.3/H,4/I,4.6/J,5/K,5.5/L}{
            \path[draw, fill=blue] (\x,0) circle[radius=2pt] node [above=2 mm, blue] {\name};
        }
    \end{tikzpicture}
\end{document}

You could automate the labeling and make the drawing of the line automated dependent on the coordinates that you enter. This is the basic method though, the result looks like this:

enter image description here