Punkte im Diagramm durch gepunktete Linien verbinden

Punkte im Diagramm durch gepunktete Linien verbinden

Wie könnte ich diese Punkte mit gepunkteten, vertikalen Linien verbinden?

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[axis lines=center]
\addplot [only marks] table{
0 0.00390625
1 0.05078125
2 0.26171875
3 0.68359375
4 1
};
\addplot [domain=0:1] {0.00390625};
\addplot [domain=1:2] {0.05078125};
\addplot [domain=2:3] {0.26171875};
\addplot [domain=3:4] {0.68359375};
\addplot [domain=4:5] {1};
\end{axis}
\end{tikzpicture}

\end{document}

Antwort1

So was?

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[axis lines=center]
\addplot [only marks] table{
0 0.00390625
1 0.05078125
2 0.26171875
3 0.68359375
4 1
};
\addplot [domain=0:1] {0.00390625}coordinate[pos=1](b);
\addplot [domain=1:2] {0.05078125}coordinate[pos=0](c)coordinate[pos=1](d);
\addplot [domain=2:3] {0.26171875}coordinate[pos=0](e)coordinate[pos=1](f);
\addplot [domain=3:4] {0.68359375}coordinate[pos=0](g)coordinate[pos=1](h);
\addplot [domain=4:5] {1}coordinate[pos=0](i);
\draw[thick,dotted,red] (b) -- (c)(d) -- (e) (f) -- (g) (h) -- (i);
\end{axis}
\end{tikzpicture}

\end{document}

Bildbeschreibung hier eingeben

Ich habe die Koordinaten zusammen mit der Grafik definiert und dann ist das Zeichnen der Linien eine formale Angelegenheit.

verwandte Informationen