[Tex/LaTex] Why are some of the boxplots dashed

boxplotpgfplots

Here's a MWE:

\documentclass[a4paper]{standalone}

\usepackage{pgfplots}
\usepgfplotslibrary{statistics}
\pgfplotsset{compat=1.8}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
boxplot/draw direction=y,
ylabel={root mean square error (RMSE)},
height=8cm,
boxplot={
    %
    % Idea: 
    %  place the 
    %  group 1 at 0.3333 and 0.6666
    %  group 2 at 1.3333 and 1.6666
    %  group 3 at 2.3333 and 2.6666
    %  ...
    % in a formular:
    draw position={1/3 + floor(\plotnumofactualtype/2) + 1/3*mod(\plotnumofactualtype,2)},
    %
    % that means the box extend must be at most 0.33333 :
    box extend=0.3
},
% ... it also means that 1 unit in x controls the width:
x=2cm,
% ... and it means that we should describe intervals:
xtick={0,1,2,...,10},
x tick label as interval,
xticklabels={%
    {dataset 1\\{\tiny disabled enabled}},%
    {dataset 2\\{\tiny disabled enabled}},%
    {dataset 3\\{\tiny disabled enabled}},%
    {dataset 4\\{\tiny disabled enabled}},%
},
    x tick label style={
        text width=2.5cm,
        align=center
    },
]


%disabled
%'120689': [2.7646732338376374, 2.9386338075128915, 2.0759453040402924, 1.4933341587154352, 1.2858810574360171], 
%'123092': [1.6213436825515752, 3.659127461813457, 6.3573913630881957, 2.851522397932257, 1.4161184310137278]
%'122034': [2.7782786785170344, 2.388295853323815, 1.0169391397932168, 1.3282220840941463, 1.1519878464320008], 
%'overd': [1.4050751524256098, 1.1888905444333131, 4.330757692491046, 3.665914730249296, 1.4398896445581748], 

%enabled
%'120689': [1.1753863748576165, 2.8136463510466894, 2.0065471893571609, 3.8938997085167464, 2.0129749752740276], 
%'123092': [2.2803725936262524, 1.4825727354215965, 1.7871388688900045, 2.3261434769789657, 1.795254324625537]
%'122034': [1.0286497508188084, 1.5717822303817375, 4.0903690748471373, 3.8755839151245763, 1.8905509506317051], 
%'overd': [2.9370285732792341, 1.3202361917111065, 1.3576990603035917, 1.852324571876895, 1.2151847831011142], 

\addplot
table[row sep=\\,y index=0] {
data\\
2.764\\
2.938\\
2.075\\
1.493\\
1.285\\
};

\addplot
table[row sep=\\,y index=0] {
data\\
1.175\\
2.813\\
2.006\\
3.893\\
2.012\\
};

\addplot
table[row sep=\\,y index=0] {
data\\
1.621\\
3.659\\
6.357\\
2.851\\
1.416\\
};

\addplot
table[row sep=\\,y index=0] {
data\\
2.280\\
1.482\\
1.787\\
2.326\\
1.795\\
};

\addplot
table[row sep=\\,y index=0] {
data\\
2.778\\
2.388\\
1.016\\
1.328\\
1.151\\
};

\addplot
table[row sep=\\,y index=0] {
data\\
1.028\\
1.571\\
4.090\\
3.875\\
1.890\\
};

\addplot
table[row sep=\\,y index=0] {
data\\
1.405\\
1.188\\
4.330\\
3.665\\
1.439\\
};

\addplot
table[row sep=\\,y index=0] {
data\\
2.937\\
1.320\\
1.357\\
1.852\\
1.215\\
};

\end{axis}
\end{tikzpicture}


\end{document}

Why are the last three boxplots dashed?

what-the-hell

Sorry that there's still so much code in the MWE, it's just that the dashed boxplots don't appear if I try to make the MWE smaller. :/

Best Answer

As @darthbith said in his comment to my question:

At a guess, its due to the cycle lists that pgfplots uses to pick the line styles. See page 173 of the 1.10 manual. – darthbith 7 hours ago

Therefore, I took control of the cycle list (and added ymin/ymax values) to let the plot behave as I had originally intended, by adding line 15, cycle list={{red},{blue}},.

MWE:

\documentclass[a4paper]{standalone}

\usepackage{pgfplots}
\usepgfplotslibrary{statistics}
\pgfplotsset{compat=1.8}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
boxplot/draw direction=y,
ylabel={RMSE},
height=6cm,
ymin=0,ymax=7,
cycle list={{red},{blue}},
boxplot={
        %
        % Idea: 
        %  place the 
        %  group 1 at 0.3333 and 0.6666
        %  group 2 at 1.3333 and 1.6666
        %  group 3 at 2.3333 and 2.6666
        %  ...
        % in a formular:
        draw position={1/3 + floor(\plotnumofactualtype/2) + 1/3*mod(\plotnumofactualtype,2)},
        %
        % that means the box extend must be at most 0.33333 :
        box extend=0.3
},
% ... it also means that 1 unit in x controls the width:
x=2cm,
% ... and it means that we should describe intervals:
xtick={0,1,2,...,10},
x tick label as interval,
xticklabels={%
        {dataset 1\\{\tiny disabled enabled}},%
        {dataset 2\\{\tiny disabled enabled}},%
        {dataset 3\\{\tiny disabled enabled}},%
        {dataset 4\\{\tiny disabled enabled}},%
},
        x tick label style={
                text width=2.5cm,
                align=center
        },
]


%disabled
%'120689': [2.7646732338376374, 2.9386338075128915, 2.0759453040402924, 1.4933341587154352, 1.2858810574360171], 
%'123092': [1.6213436825515752, 3.659127461813457, 6.3573913630881957, 2.851522397932257, 1.4161184310137278]
%'122034': [2.7782786785170344, 2.388295853323815, 1.0169391397932168, 1.3282220840941463, 1.1519878464320008], 
%'overd': [1.4050751524256098, 1.1888905444333131, 4.330757692491046, 3.665914730249296, 1.4398896445581748], 

%enabled
%'120689': [1.1753863748576165, 2.8136463510466894, 2.0065471893571609, 3.8938997085167464, 2.0129749752740276], 
%'123092': [2.2803725936262524, 1.4825727354215965, 1.7871388688900045, 2.3261434769789657, 1.795254324625537]
%'122034': [1.0286497508188084, 1.5717822303817375, 4.0903690748471373, 3.8755839151245763, 1.8905509506317051], 
%'overd': [2.9370285732792341, 1.3202361917111065, 1.3576990603035917, 1.852324571876895, 1.2151847831011142], 

\addplot
table[row sep=\\,y index=0] {
data\\
2.764\\
2.938\\
2.075\\
1.493\\
1.285\\
};

\addplot
table[row sep=\\,y index=0] {
data\\
1.175\\
2.813\\
2.006\\
3.893\\
2.012\\
};

\addplot
table[row sep=\\,y index=0] {
data\\
1.621\\
3.659\\
6.357\\
2.851\\
1.416\\
};

\addplot
table[row sep=\\,y index=0] {
data\\
2.280\\
1.482\\
1.787\\
2.326\\
1.795\\
};

\addplot
table[row sep=\\,y index=0] {
data\\
2.778\\
2.388\\
1.016\\
1.328\\
1.151\\
};

\addplot
table[row sep=\\,y index=0] {
data\\
1.028\\
1.571\\
4.090\\
3.875\\
1.890\\
};

\addplot
table[row sep=\\,y index=0] {
data\\
1.405\\
1.188\\
4.330\\
3.665\\
1.439\\
};

\addplot
table[row sep=\\,y index=0] {
data\\
2.937\\
1.320\\
1.357\\
1.852\\
1.215\\
};

\end{axis}
\end{tikzpicture}


\end{document}

Output:

better