1

I try to make some boxplots to some given data and use the calculated values (pgfplots did) of the median, quartiles, average,... outside the axis environment.

My MWE:

\documentclass[utf8,fleqn]{scrartcl}
\usepackage[ngerman]{babel}
    

\usepackage{pgfplots}
\usepgfplotslibrary{statistics}
\usepackage{filecontents}


\begin{document}

\begin{filecontents*}{\jobname.csv}
v
0.1
0.2
0.3
0.8
0.9
1.0 
1.5
 \end{filecontents*}


\begin{tikzpicture}[scale=1]
\begin{axis}[
boxplot,
table/y=v,
xmin=0, xmax=1.6, 
ymin=0, ymax=2,
]
    \addplot[fill=orange, thick] table[] {\jobname.csv} 
[above]
node at (boxplot box cs: \boxplotvalue{median},1){Median \pgfmathprintnumber{\boxplotvalue{median}}}
;

\end{axis}
\end{tikzpicture}


\end{document}

I can view the values inside the plot, but any attempt to use it outside failed up to now. Any def, xdef, did not work.

Any suggestions? Thanks very much.

1 Answer 1

1

Finally I found the place to define the values:

    \addplot[fill=orange, thick] table[] {\jobname.csv} 
[above]
node at (boxplot box cs: \boxplotvalue{median},1){Median \pgfmathprintnumber{\boxplotvalue{median}}\xdef\med{\boxplotvalue{median}}\xdef\uq{\boxplotvalue{upper quartile}}\xdef\lq{\boxplotvalue{lower quartile}}\xdef\uw{\boxplotvalue{upper whisker}}\xdef\lw{\boxplotvalue{lower whisker}}\xdef\av{\boxplotvalue{average}}}
;

You must log in to answer this question.

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