1

I am trying to change the color of my plots in pgfplots but the argument color in addplot is not recognized. Here is my picture:

enter image description here

and here is my code:

  \begin{figure*}[t]
  \centering
  \hspace{-5em}\begin{subfigure}[t]{0.6\columnwidth}
  \captionsetup{justification=centering}
  \begin{tikzpicture}
  \begin{axis}[
   axis y line=none,
   y=0.3cm,
   x=1cm,
   xtick={15,15.5,16,...,18},
   restrict y to domain=1:5,
   axis lines=left,
   enlarge x limits=upper,
   cycle list name=exotic,
   scatter/classes={
   o={mark=*}
   },
   scatter,
   scatter src=explicit symbolic,
   every axis plot post/.style={mark=*,thick},
   xlabel=Time,
   x label style={at={(axis description cs:0.95,-0.1)},anchor=south},
   xticklabels={,,},
   legend style={
      draw=none,
      at={(-0.1,-1)},
      anchor=south east
  },
  legend image post style={mark=none}
  ]
\addplot table [y expr=1,meta index=1, header=false] {
17.5 c
18 c
};\addlegendentry{$g_{\alpha}$}
\addplot table [y expr=1,meta index=1, header=false] {
15 c
16.5 c
};\addlegendentry{$\backhtxt g_{\alpha}$}
\addplot table [y expr=2,meta index=1, header=false] {
16.5 c
16 c
};\addlegendentry{$\zonep{\delta-\varepsilon}g_{\alpha}$}
\addplot table [y expr=3,meta index=1, header=false] {
16.4 c
15.9 c
};\addlegendentry{$\zonep{\delta-2\varepsilon}g_{\alpha}$}
\addplot table [y expr=4,meta index=1, header=false] {
16.3 c
15.8 c
};\addlegendentry{$\zonep{\delta-3\varepsilon}g_{\alpha}$}
  \end{axis}

\end{tikzpicture}
  \caption{Example of an interaction guard $g_{\alpha}$ and its planning intervals}
\end{subfigure}\hspace{15em}
\begin{subfigure}[t]{0.6\columnwidth}
  \captionsetup{justification=centering}
  \begin{tikzpicture}
  \begin{axis}[
   axis y line=none,
   y=0.3cm,
   x=1cm,  
   xtick={15,15.5,16,...,18},
   restrict y to domain=1:5,
   axis lines=left,
   enlarge x limits=upper,
   scatter/classes={
   o={mark=*,fill=white}
   },
   scatter,
   cycle list name=exotic,
   scatter src=explicit symbolic,
   every axis plot post/.style={mark=*,thick},
   xlabel=Time,
   x label style={at={(axis description cs:0.95,-0.1)},anchor=south},
   xticklabels={,,},
   legend style={
      draw=none,
      at={(2,-1)},
      anchor=south east
  },
  legend image post style={mark=none}
  ]
\addplot table [y expr=1,meta index=1, header=false] {
17.5 c
18 c
};\addlegendentry{$g_{\alpha}$}
\addplot table [y expr=1,meta index=1, header=false] {
15 c
16.5 c
};\addlegendentry{$\backhtxt g_{\alpha}$}
\addplot table [y expr=2,meta index=1, header=false] {
16.5 c
16 c
};\addlegendentry{$\zonep{\delta-d}g_{\alpha}$}
\addplot table [y expr=3,meta index=1, header=false] {
16 c
15.5 c
};\addlegendentry{$\zonep{\delta-2d}g_{\alpha}$}
\addplot table [y expr=4,meta index=1, header=false] {
15.5 c
15 c
};\addlegendentry{$\zonep{\delta-3d}g_{\alpha}$}
  \end{axis}

\end{tikzpicture}
  \caption{Discretized planning intervals for $g_{\alpha}$}
\end{subfigure}
\caption{Discretizing Planning Horizons for Interaction}
\label{fig:disc}
\end{figure*}

When I remove the cycle list name from the axis parameters, I got an automatic coloring of my lines, and when I try to force the color by adding for example \addplot table [color=red,...] the color is not taken into account.

Any idea on what causes this?

Troy
  • 13,741
Mr. D
  • 397
  • 1
    please, extend your code snippet to MWE! – Zarko Mar 28 '17 at 13:31
  • 1
    The color is an option to the plot, not the table reading, so \addplot [red] table ... – Torbjørn T. Mar 28 '17 at 13:39
  • 1
    I am pretty sure there was a question in the near past that had the same problem ... – Stefan Pinnow Mar 28 '17 at 13:43
  • Oh ok!!! I thought that the parameters are the one of the plot!! problem solved!! – Mr. D Mar 28 '17 at 13:56
  • @StefanPinnow Were you thinking about http://tex.stackexchange.com/questions/346934? – Torbjørn T. Mar 28 '17 at 17:04
  • @TorbjørnT., I think yes, but I wasn't aware any more of that I answered that question as well. I thought you did it ;) Do you agree that in principle that is the same question and the answer fits as well? Then we could vote it being a duplicate. – Stefan Pinnow Mar 28 '17 at 17:08
  • 1
    @StefanPinnow I also had something else in mind, but that one was the first my searching found. I think it's the same, so we can vote to close. – Torbjørn T. Mar 28 '17 at 17:39

0 Answers0