tikz add tag
Raaja
I have two curves sampled as shown below:

```
%&lualatex
% !TeX TXS-program:compile = txs:///lualatex/[--shell-escape]
\documentclass[convert={density=600,outext=.tiff}]{standalone}
\usepackage{tikz, pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=2in, height=2in,xmin = 0, xmax = 1050, ymin = 0, ymax = 10, ylabel = {[$\sim$]}, xlabel = {[\#]},legend style={at={(1,0)}, anchor=south east, font=\tiny, draw=none, fill=none}]	;
\addplot [mesh, domain = 0:1000,samples=300] {5*(1-exp(-0.003*x))};
\addplot [black, domain=0:1000, samples = 18, only marks, mark size = 1pt, mark = +] {5*(1-exp(-0.003*x))};
\addplot [black, domain=0:1100, samples = 18, only marks, mark size = 1pt, mark = +] {10 - 5*(1-exp(-0.003*x))};
\end{axis}
\end{tikzpicture}
\end{document}
```

I want to draw lines between the sampled data-points shown below:

![iwd.jpg](/image?hash=efae4baf3c987a997f0c4dcf9d7fb2e3685cd4c48cfd615a743133c95422f851)

But not sure how to achieve it.
Top Answer
user 3.14159
Another way is to use `nodes near coords`.
```
\documentclass[tikz,convert={density=600,outext=.tiff}]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\pgfplotsset{% https://tex.stackexchange.com/a/75811/121799
    name nodes near coords/.style={nodes near coords={},
        every node near coord/.append style={anchor=center,coordinate,
            name=#1-\coordindex,/utils/exec=\typeout{#1-\coordindex},
            alias=#1-last,
        },
    },
    name nodes near coords/.default=coordnode
}

\begin{document}
\begin{tikzpicture}
\begin{axis}[width=2in, height=2in,xmin = 0, xmax = 1050, ymin = 0, ymax = 10,
ylabel = {[$\sim$]}, xlabel = {[\#]},legend style={at={(1,0)}, anchor=south
east, font=\tiny, draw=none, fill=none},declare function={f(\x)=5*(1-exp(-0.003*\x));}]	;
\addplot [mesh, domain = 0:1000,samples=300] {f(x)};
\addplot [black, domain=0:1000, samples = 18, only marks, mark size = 1pt, mark=
+,name nodes near coords=T] {f(x)};
\addplot [black, domain=0:1100, samples = 18, only marks, mark size = 1pt, mark
= +,name nodes near coords=B] {10 -f(x)};
\end{axis}
\foreach \X in {0,...,16}
{\draw (B-\X) -- (T-\X);}
\end{tikzpicture}
\end{document}
```

![Screen Shot 2020-02-07 at 7.53.29 AM.png](/image?hash=482e506e2a903f21ce321a71ccb60db9bd7b6e581ac49476aad616c33b356798)

A potential problem is that the last mark on the upper plot gets clipped away, and thus not connected.
Answer #2
samcarter
Not very elegant, but worst case you could add the lines manually:

```
\documentclass{standalone}
\usepackage{tikz, pgfplots}

\tikzset{
  declare function={
    f(\x)=(5*(1-exp(-0.003*\x))));
  }
}

\begin{document}
\begin{tikzpicture}
\begin{axis}[width=2in, height=2in,xmin = 0, xmax = 1050, ymin = 0, ymax = 10, ylabel = {[$\sim$]}, xlabel = {[\#]},legend style={at={(1,0)}, anchor=south east, font=\tiny, draw=none, fill=none}]	;
\addplot [mesh, domain = 0:1000,samples=300] {f(x)};
\addplot [black, domain=0:1000, samples = 18, only marks, mark size = 1pt, mark = +] {f(x)};
\addplot [black, domain=0:1100, samples = 18, only marks, mark size = 1pt, mark = +] {10 - f(x)};
\foreach \i in {0,...,18}{
  \addplot[mark=none] coordinates {(\i*1100/17,{10-f(x)}) (\i*1000/17,{f(x)})};
}
\end{axis}
\end{tikzpicture}
\end{document}
```

![document.png](/image?hash=0c6ebc3619dcb621e8d5a64014e3f9650072622bc77cae289f1dffbef7dd9bd3)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.