# pgfplots spline and colorseries do not work

I want to create a plot with predefined colors and have the points connected by a spline curve.

Both things do not happen. The color series is not applied (all lines are black) and a spline is not applied to the curve.

\documentclass[]{scrbook}

\usepackage{pgfplots}
\usetikzlibrary{pgfplots.patchplots}

\definecolor{colorseriesRGB1}{RGB}{0,     0, 192}
\definecolor{colorseriesRGB2}{RGB}{192,   0,   0}
\definecolor{colorseriesRGB3}{RGB}{0  , 128,   0}
\definecolor{colorseriesRGB4}{RGB}{192,   0, 192}

\pgfplotscreateplotcyclelist{colorseries-rgb}{
{colorseriesRGB1},
{colorseriesRGB2},
{colorseriesRGB3},
{colorseriesRGB4},
}

\begin{document}
\pgfplotsset{width=0.8\textwidth, height=0.6\textwidth}
\begin{tikzpicture}
\begin{axis}[cycle list name=colorseries-rgb]
\end{axis}
\end{tikzpicture}
\end{document}


EDIT:

My original code is using a datatable. If I add the options mesh,patch,patch type=quadratic spline then the plot looks completely wrong

\begin{tikzpicture}
\begin{axis}[scale only axis,
every axis plot/.append
style={line width=1.5pt},
mark=none,
style=solid,
enlargelimits=false, ymax = 3.5,
cycle list name=colorseries-office,
% smooth,
]
\end{axis}
\end{tikzpicture}


However the option smooth, although I have no idea what it really does looks like what I want:

-

If you have no optional arguments, then simply using

\addplot {x^2 - x +4};


will inherit the correct styles that you have specified. However, if you wish to override some of the arguments but keep the other aspects (as you have done in your code), then you have to use \addplot+[...

\addplot+[samples = 10] {x^2 - x +4};


which tells pgfplots to use the styles specified in cyclelist, but change the options that you have specified.

See Section 4.6.7 for more examples.

With regards to the quadratic spline, referencing Section 5.6.1,

The quadratic spline is actually nothing but piecewise Lagrangian interpolation with quadratic polynomials: it expects three points in the sequence ‘(left end), (right end), (middle)’ and interpolates these three points with a quadratic polynomial.

As such, for your example you can use something like

% left, right, middle

What I was looking for seems to be the option smooth, but then I do not understand the meaning of patch at all. If I also add the option patch, then my line is dashed and with variing colors in a line. –  Matthias Pospiech Mar 18 '12 at 21:56
@cmhughes Add smooth? –  Yiannis Lazarides Mar 18 '12 at 21:56
@MatthiasPospiech AFAIK smooth and patch are for situations where you have coordinates; if you have the formula, why not just increase samples? –  cmhughes Mar 18 '12 at 21:59