I am trying to create notched box plots similar to those shown in the picture from data files.

I have managed code that creates the box plots with notches like I want (the code below without the axis and addplot commands), but am having trouble adding axes. My setup for drawing the box plots does not work when I use \addplot and if I don't use \addplot I get other errors or depending on how I move the code for my axis, I get only the axes. I cannot think how to fix this.
\documentclass{article}
\usepackage{pgfplots}
\usepackage{filecontents}
\usepackage{pgfplotstable}
\usetikzlibrary{calc}
\begin{document}
\begin{filecontents}{boxplot.dat}
1 1 1.2 0.4 1.5 0.2 1.05 0.95
2 2 2.3 1.5 2.7 1 2.05 1.95
3 0.7 1.4 0.5 1.9 0.1 0.75 0.65
4 0.7 1.4 0.5 1.9 0.1 0.75 0.65
\end{filecontents}
\pgfplotstableread{boxplot.dat}{\infotable}
\pgfplotstablegetrowsof{boxplot.dat}
\pgfmathsetmacro{\rows}{\pgfplotsretval-1}
\begin{tikzpicture}
\begin{axis}[
xticklabels={1, 2, 3, 4},
]
\addplot{
\foreach \i in {0,...,\rows}{%
%x-values
\pgfplotstablegetelem{\i}{[index] 0}\of{\infotable}
%Middle
\let\xM\pgfplotsretval
%Left
\pgfmathsetmacro{\xL}{\xM-0.25}
\pgfmathsetmacro{\xLInd}{\xM-0.125}
%Right
\pgfmathsetmacro{\xR}{\xM+0.25}
\pgfmathsetmacro{\xRInd}{\xM+0.125}
%y-values
\pgfplotstablegetelem{\i}{[index] 4}\of{\infotable}
\let\yTopWhisk\pgfplotsretval
\pgfplotstablegetelem{\i}{[index] 2}\of{\infotable}
\let\yBoxTop\pgfplotsretval
\pgfplotstablegetelem{\i}{[index] 6}\of{\infotable}
\let\yTopInd\pgfplotsretval
\pgfplotstablegetelem{\i}{[index] 1}\of{\infotable}
\let\yMedian\pgfplotsretval
\pgfplotstablegetelem{\i}{[index] 7}\of{\infotable}
\let\yBottomInd\pgfplotsretval
\pgfplotstablegetelem{\i}{[index] 3}\of{\infotable}
\let\yBoxBottom\pgfplotsretval
\pgfplotstablegetelem{\i}{[index] 5}\of{\infotable}
\let\yBottomWhisk\pgfplotsretval
%top part
\draw [blue] (\xLInd,\yMedian) -- (\xL,\yTopInd) -- (\xL,\yBoxTop) -- (\xR,\yBoxTop) -- (\xR,\yTopInd) -- (\xRInd,\yMedian);
%bottom part
\draw [blue] (\xLInd,\yMedian) -- (\xL,\yBottomInd) -- (\xL,\yBoxBottom) -- (\xR,\yBoxBottom) -- (\xR,\yBottomInd) -- (\xRInd,\yMedian);
%median
\draw [red] (\xLInd,\yMedian) -- (\xRInd,\yMedian);
%top whisker
\draw [black] (\xM,\yBoxTop) -- (\xM,\yTopWhisk);
\draw [black] (\xL,\yTopWhisk) -- (\xR,\yTopWhisk);
%bottom whisker
\draw [black] (\xM,\yBoxBottom) -- (\xM,\yBottomWhisk);
\draw [black] (\xL,\yBottomWhisk) -- (\xR,\yBottomWhisk);
}%
}
\end{axis}
\end{tikzpicture}
\end{document}
