1

I adapted the following code from here

\begin{tikzpicture}[scale=.8,line width=1pt]
\begin{axis}[
boxplot/draw direction=y,
ylabel={Latency (\textmu s)},
xlabel={Packet Size (Bytes)},
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/4 + floor(\plotnumofactualtype/3) + 1/4*mod(\plotnumofactualtype,3)},
    %
    % that means the box extend must be at most 0.33333 :
    box extend=0.2,
},
% ... 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={%
    {64B},%
    {500B},%
    {1500B},%
},
x tick label style={
    text width=2.5cm,
    align=center
},
cycle list={{red},{blue},{black}},
]

\addplot
table[row sep=\\,y index=0] {
    data\\
    20\\
    516\\
    710\\
    503\\
    1253\\
};
\addplot
table[row sep=\\,y index=0] {
    data\\
    759\\
    419\\
    309\\
    883\\
    299\\
};
\addplot
table[row sep=\\,y index=0] {
    data\\
    684\\
    340\\
    700\\
    325\\
    377\\
};


\addplot
table[row sep=\\,y index=0] {
    data\\
    516\\
    480\\
    1356\\
    200\\
    736\\
};
\addplot
table[row sep=\\,y index=0] {
    data\\
    684\\
    340\\
    700\\
    325\\
    377\\
};
\addplot
table[row sep=\\,y index=0] {
    data\\
    759\\
    419\\
    309\\
    883\\
    299\\
};

\addplot
table[row sep=\\,y index=0] {
    data\\
    956\\
    320\\
    811\\
    330\\
    381\\
};
\addplot
table[row sep=\\,y index=0] {
    data\\
    684\\
    340\\
    700\\
    325\\
    377\\
};
\addplot
table[row sep=\\,y index=0] {
    data\\
    280\\
    749\\
    392\\
    870\\
    488\\
};

\end{axis}
\end{tikzpicture}

However the data doesn't make sense to me, i.e. I don't understand which one is min, max, median, nth quartile. Any chance to use boxplot prepared in this code?

alan
  • 11
  • If you have the data, you can compute those quantities right? Which part is causing difficulty? – percusse Apr 13 '18 at 13:24
  • The data in the tables above is copy & paste from the link. For instance first one has 20 which seems like min, but when I change 516 or 710 I can't make sense which one is the max or nth quartile. – alan Apr 13 '18 at 16:17
  • Have you read the description of boxplot in the pgfplots manual? – Torbjørn T. Apr 13 '18 at 16:26

0 Answers0