Pgfplots: wrong legend image

Convince yourself about the color and image of the marker and line (where there should only be one at the time). Effectively the color and marker/line stay at the default value even though specified differently.

What am I doing wrong or is it a bug?

\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[legend style={at={(0.2,0.5)},anchor=north}]
\addplot table[col sep=comma, color=red, only marks] {
0,2
2,4
5,5
};
\addplot table[col sep=comma, color=red, mark=none] {
0,2.4
5,5.4
};
\end{axis}
\end{tikzpicture}

\end{document}


Both traces are supposed to be red and one without marker and the other without line but the legend shows both.

It is no bug, you are just putting the directives at the wrong place.

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}

\begin{document}

\begin{tikzpicture}
\begin{axis}[legend style={at={(0.2,0.5)},anchor=north}]
\addplot[color=red, only marks] table[col sep=comma] {
0,2
2,4
5,5
};