[Tex/LaTex] Min, Max and Average in Bar Chart pgfplots

pgfplots

I'm trying to create a bar chart from the min until the max value with an average line.
So far, I have line with a min, max and average but I want the to be wider bars. Is there any way to do that?

That's what I got so far but I want bars instead of lines

\pgfplotstableread{
x         y    y-max  y-min
AfterCoffee     17.62       26.566667   9.0
BeforeCoffee    14.42       23.0333333      8.683333  
}{\mytable}


\begin{tikzpicture}[scale=1.3] 
\begin{axis} [
    width  = 0.5*\textwidth,
    height = 8cm,
    symbolic x coords={AfterCoffee,BeforeCoffee},
    xtick=data
]
\addplot+[blue, very thick, forget plot,only marks] 
  plot[very thick, error bars/.cd, y dir=plus, y explicit]
  table[x=x,y=y,y error expr=\thisrow{y-max}] {\mytable};
\addplot+[red, very thick, only marks,xticklabels=\empty] 
  plot[very thick, error bars/.cd, y dir=minus, y explicit]
  table[x=x,y=y,y error expr=\thisrow{y-min}] {\mytable};
\end{axis} 
\end{tikzpicture}

Best Answer

You can control format of error bar with every error bar.

Just add

\pgfplotsset{every error bar/.style={line width=1mm}}

Or

\pgfplotsset{every error bar/.style={ultra thick}}

Code

\documentclass{article}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\begin{document}

\pgfplotsset{every error bar/.style={line width=1mm}}

\pgfplotstableread{
x         y    y-max  y-min
AfterCoffee     17.62       26.566667   9.0
BeforeCoffee    14.42       23.0333333      8.683333  
}{\mytable}


\begin{tikzpicture}[scale=1.3] 
\begin{axis} [
    width  = 0.5*\textwidth,
    height = 8cm,
    symbolic x coords={AfterCoffee,BeforeCoffee},
    xtick=data
]
\addplot+[blue, very thick, forget plot,only marks] 
  plot[very thick, error bars/.cd, y dir=plus, y explicit]
  table[x=x,y=y,y error expr=\thisrow{y-max}] {\mytable};
\addplot+[red, very thick, only marks,xticklabels=\empty] 
  plot[very thick, error bars/.cd, y dir=minus, y explicit]
  table[x=x,y=y,y error expr=\thisrow{y-min}] {\mytable};
\end{axis} 
\end{tikzpicture}
\end{document}

enter image description here