0

I'd like to save a cycle list in PGFPlots that I have defined using cycle multiindex* list. See MWE below. When I try to do this though I just get black lines in my plot.

How can I save my custom list under a unique identifier?

\documentclass{standalone}

\usepackage{pgfplots}
\usepgfplotslibrary{colorbrewer} 

\pgfplotsset{
    compat=1.17,
    colormap/Set1,
}

\pgfplotscreateplotcyclelist{TestList}{
    cycle multiindex* list={
    mark list*\nextlist
    Set1\nextlist},
}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[
            cycle list name=TestList
        ]
        \addplot+ [domain=0:5] {x};
        \addplot+ [domain=0:5] {x^2};
        \addplot+ [domain=0:5] {10*sin(deg(x))};
        \addplot+ [domain=0:5] {10*cos(deg(x))};
    \end{axis}
\end{tikzpicture}
\end{document}

1 Answer 1

0

I am not sure how to directly create such a cycle list. But you can create a style that incorporates the cycle list and than call it in the axis options.

% used PGFPlots v1.17
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
    \usepgfplotslibrary{colorbrewer}
    \pgfplotsset{
        colormap/Set1,
        % define a style that incorporates the `cycle list`
        TestList cycle list/.style={
            cycle multiindex* list={
                mark list*\nextlist
                Set1\nextlist%
            },
        },
    }
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        % call the defined style
        TestList cycle list,
    ]
        \addplot+ [domain=0:5] {x};
        \addplot+ [domain=0:5] {x^2};
        \addplot+ [domain=0:5] {10*sin(deg(x))};
        \addplot+ [domain=0:5] {10*cos(deg(x))};
    \end{axis}
\end{tikzpicture}
\end{document}

image showing the result of above code

2
  • That works. Thank you!
    – Nukesub
    Commented Feb 21, 2021 at 15:01
  • How to remove the marker of one specific line from both the curve and legend image? Because setting mark=none for one plot doesn't remove the marker from the legend image.
    – Diaa
    Commented Apr 25 at 9:27

You must log in to answer this question.

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