2

I have a simple example where the line styles in the diagram don't match the line styles in the key. The latter is correct.

Using Texlive 2015 just installed. tlmgr says no updates of pgfplots avail.

\documentclass{article}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{tikz,pgfplots}

\pgfplotsset{compat=1.12}

\begin{document}
\begin{figure*}
    \begin{tikzpicture}
        [line join=round]
        \begin{axis}[legend style={at={(1,0.7)},anchor=west},
        ylabel={I don't know what this is},
        x tick label style={/pgf/number format/.cd,
                            use comma,
                             1000 sep={}}]
            \addplot table [ x=Year, y=CC_IHW, col sep=comma, mark=none] {numbers.csv};
            \addplot table [ x=Year, y=CC_W, col sep=comma, mark=none] {numbers.csv};
            \addplot table [ x=Year, y=ML_IHW, col sep=comma, mark=none] {numbers.csv};
            \addplot table [ x=Year, y=ML_W, col sep=comma, mark=none] {numbers.csv};
            \addplot table [ x=Year, y=MS_IHW, col sep=comma, mark=none] {numbers.csv};
            \addplot table [ x=Year, y=MS_W, col sep=comma, mark=none] {numbers.csv};
            \legend{CCIHW,CCW,MLIHW,MLW,MSIHW,MSW} 
        \end{axis}
    \end{tikzpicture}
\end{figure*}
\end{document}
1
  • To be more specific, the lines in the legend feature boxes, circles, stars. Lines in the graph have no boxes, stars etc. Dec 2, 2015 at 21:50

2 Answers 2

2

Use

\addplot+[mark=none] table [ x=Year, y=CC_IHW, col sep=comma] {numbers.csv};

to remove the marks from both the plot and the legend.

1

Removing , mark=none for each \addplot table line fixes the problem. The lines in the graph now correspond to the key.

P.S. I just updated TeX Live with the express purpose of fixing this, but doubtful it was necessary.

1
  • 2
    As esdd hints at in his answer, you've added mark=none in the wrong place. Options relating to the plot itself should be placed in brackets, immediately after \addplot. You've placed it along with the options to the table. It still halfway works, but pgfplots apparently doesn't see that mark style when it generates the legend. Jan 1, 2016 at 12:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .