[Tex/LaTex] PGFplot: Adding a single marker to a graph (while keeping the marker symbol in the legend)

pgf-decorationspgfplotspgfplotstabletikz-pgf

What I want: I want a single marker per graph. EDIT: .. and I want it in the legend, too, of course.

I've got my plots, however, for the plots that include several graphs (that are colour-coded at the moment), markers would be helpful to identify the graphs if printed in b/w. As the displayed data are measurement points (so … a lot.) and the plot itself is quite small –

What I tried: The topic on Uniformly spaced line markers seems like a good start, but I don't get it right and PGFmanual on markers did not help.

EDIT: I adapted my document according to percusses answer.
(I will add the new code below the first MWE)
Now, i can specify through the options mark repeat, mark phase and mark indices exactly where my single line marker should be.
Unfortunately, this leads to another problem:

Whenever mark phase or mark indices exceed 3, the marker symbol is no longer visible in the legend.

EDIT2: until somebody knows, i'll just use dashed, dotted, loosely dotted.

enter image description here

My MWE looks currently results in the error message I cannot decorate an empty path and looks like this:

\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usetikzlibrary{decorations}
\usetikzlibrary{decorations.markings}
\pgfplotsset{compat=1.12}
\pgfplotstableread[col sep=space]{%
3.00000000000000000E5   -4.61253023410550080E-1 
1.02940000000000010E7   -4.55672800606340720E-1 
5.02699999999999920E7   -3.91807294333980050E-1
8.02519999999999990E7   -3.48624605959662140E-1
1.50209999999999980E8   -1.65721032451684700E-1
3.00119999999999990E8   -1.46435431917354890E0
4.00060000000000040E8   -3.74356509404440270E0
5.00000000000000000E8   -7.38193327106199960E0
}\datat
\pgfplotstableread[col sep=space]{%     
3.00000000000000000E5   -4.61794340041841340E0  
1.02940000000000010E7   -4.67100110335846350E0
5.02699999999999920E7   -6.73887674244128480E0
8.02519999999999990E7   -8.64259069270219630E0
1.50209999999999980E8   -1.12337266256919330E1
3.00119999999999990E8   -1.04363631270434580E1
4.00060000000000040E8   -8.60938872558673650E0
5.00000000000000000E8   -7.25211587497674510E0
}\datav     
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
height=5cm,
width=5cm,
legend pos= south east,
legend style={nodes={scale=0.65, transform shape}},
ymin=-30,
ymax=0,
xmin=0,
xmax=5e8,
enlargelimits=0.05,
]
\addplot+[red, % this is from the linked topic
postaction={
    decoration={
        markings,
        mark=between positions 0 and 1 step 0.4
        with { \fill circle[radius=2pt]; },
    },
    decorate,
},
domain=0:16,
samples=10] table [col sep=space]from \datav;
\addplot+[] table [col sep=space]from \datat;
\legend{chocolate, cotton candy};
\end{axis}
\end{tikzpicture} 
\end{document}

EDIT MWE:

\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.12}
\pgfplotstableread[col sep=space]{%
3.00000000000000000E5   -4.61253023410550080E-1 
1.02940000000000010E7   -4.55672800606340720E-1 
5.02699999999999920E7   -3.91807294333980050E-1
8.02519999999999990E7   -3.48624605959662140E-1
1.50209999999999980E8   -1.65721032451684700E-1
3.00119999999999990E8   -1.46435431917354890E0
4.00060000000000040E8   -3.74356509404440270E0
5.00000000000000000E8   -7.38193327106199960E0
}\datat
\pgfplotstableread[col sep=space]{%     
3.00000000000000000E5   -4.61794340041841340E0  
1.02940000000000010E7   -4.67100110335846350E0
5.02699999999999920E7   -6.73887674244128480E0
8.02519999999999990E7   -8.64259069270219630E0
1.50209999999999980E8   -1.12337266256919330E1
3.00119999999999990E8   -1.04363631270434580E1
4.00060000000000040E8   -8.60938872558673650E0
5.00000000000000000E8   -7.25211587497674510E0
}\datav     
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
legend pos= south east,
ymin=-30,
ymax=0,
xmin=0,
xmax=5e8,
enlargelimits=0.05,
mark options={mark indices=3}, % still visible in legend, but not centered
% mark options={mark indices=4}, % outside the displayed legend line
]
\addplot+[draw=red] table [col sep=space] \datav;
\addplot+[] table [col sep=space]from \datat;
\legend{chocolate, cotton candy};
\end{axis}
\end{tikzpicture} 
\end{document}

Best Answer

Markers are by default placed at the data points and you can select which ones should be marked. I've converted the x axis to a logarithmic to make it visually more readable.

..... Data files here 

\begin{document}
\begin{tikzpicture}
\begin{semilogxaxis}[%
legend pos= south east,
legend style={nodes={scale=0.65, transform shape}},
ymin=-30,
ymax=0,
xmin=0,
xmax=5e8,
enlargelimits=0.05,
mark options={mark indices=2}, 
]
\addplot+[draw=red,domain=0:16] table [col sep=space] \datav;
\addplot+[] table [col sep=space]from \datat;
\legend{chocolate, cotton candy};
\end{semilogxaxis}
\end{tikzpicture}
\end{document} 

enter image description here