グラフ上の点を点線で結ぶ

グラフ上の点を点線で結ぶ

これらの点を点線の垂直線で結ぶにはどうすればよいでしょうか?

\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}

答え1

このような?

\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}

ここに画像の説明を入力してください

グラフに沿って座標を定義したら、線を描くのが正式な作業になります。

関連情報