答案1
首先设置线条选项,然后(重新)设置标记选项:
\documentclass[margin=5pt]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.3}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot+[ycomb,red,dash dot, line width=1pt,opacity=0.5, mark options={blue, solid, opacity=1}] coordinates {(0,3) (1,2) (2,4) (3,1) (4,2)};
\end{axis}
\end{tikzpicture}
\end{document}