5

I am not getting the black white cycle list working. All three graphs are solid black lines. I want them to have different dash patterns though!

\documentclass[11pt, a4paper]{article}
\usepackage{pgfplots}
\begin{document}
\begin{figure} [!htbp]
\centering
\begin{tikzpicture}
\begin{axis}[
width=5in,
xlabel={Time},
ylabel={Displacement},
no markers,
yticklabel style={/pgf/number format/fixed},
cycle list name=black white,
]
\addplot+ table [x=time,y=disp_body,col sep=comma]{tables/data_static.csv};
\addplot+ table [x=time,y=disp_spring,col sep=comma]{tables/data_static.csv};
\addplot+ table [x=time,y=disp_tyre,col sep=comma]{tables/data_static.csv};
\addlegendentry{Car body}
\addlegendentry{Spring}
\addlegendentry{Tyre}
\end{axis}
\end{tikzpicture} 
\caption{Determination of static deflections}
\label{fig_static}
\end{figure}
\end{document}
2

1 Answer 1

6

There is nothing wrong with your code (though I wouldn't add standalone plus signs or I would also add []). The reason why they show up static is because the first 5 cycle definitions are with solid lines and with different markers which you turned off. From the manual

enter image description here

If you shift the cycle list you will see that it is working OK.

\documentclass[11pt, a4paper]{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
no markers,
cycle list name=black white,
]
\addplot+[] {rand};\pgfplotsset{cycle list shift=4}
\addplot+[] {rand};
\end{axis}
\end{tikzpicture} 
\end{document}

enter image description here

7
  • Ah I see! Thanks! I guess that means I can't use the black white cycle list for more than 2 plots because the 3rd line looks the same as the 2nd. Oct 29, 2014 at 23:01
  • @thirteen Yes but you can create your own cycle lists. There are a few examples in the manual so that you can fiddle with dash patterns etc.
    – percusse
    Oct 29, 2014 at 23:03
  • Found a custom cycle list in this tex.stackexchange.com/questions/134346/… which solved my problem. Oct 29, 2014 at 23:07
  • @thirteen So that link did helped you afterall :)
    – percusse
    Oct 29, 2014 at 23:09
  • Be fair: @thirteen never claimed it didn't help but only that it did not explain the problem.
    – cfr
    Oct 30, 2014 at 0:15

You must log in to answer this question.

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