I would like to shift text of nodes out of axis area like in the first image. If this is difficult to realize, would be nice also the solution in the second image, in which the right margin of area is shifted in order to let enough space for the text of the node.
The code I used is this:
\begin{filecontents*}{WHCs.dat}
Sample y y_err
5-Pa-Pr 0.520 0.10
6-Pa-Pr 0.465 0.05
7-Pa-Pr 0.768 0.16
5-Pa-S 0.517 0.10
6-Pa-S 0.562 0.20
7-Pa-S 0.794 0.35
\end{filecontents*}
\begin{tikzpicture}
\begin{axis}[
ybar, ymin=0,
bar width=15pt,
x tick label style={rotate=45, anchor=east},
major x tick style = transparent,
ymajorgrids = true,
xtick = data,
axis on top,
enlarge x limits=0.35,
scaled y ticks = false,
symbolic x coords={5-Pa-Pr, 6-Pa-Pr, 7-Pa-Pr, 5-Pa-S, 6-Pa-S, 7-Pa-S},
ymajorgrids]
\begin{scope}
\fill[brown] (rel axis cs:0,0.355) rectangle (rel axis cs:1,0.365);
\fill[green] (rel axis cs:0,0.495) rectangle (rel axis cs:1,0.505);
\fill[red] (rel axis cs:0,0.555) rectangle (rel axis cs:1,0.565);
\path
node[anchor=east] at (rel axis cs:1,0.36) {Sand}
node[anchor=east] at (rel axis cs:1,0.50) {Clay}
node[anchor=east] at (rel axis cs:1,0.56) {Silty loam};
\end{scope}
\addplot+[error bars/.cd, y dir=both,y explicit] table [x=Sample, y=y, y error=y_err] {WHCs.dat};
\end{axis}
\end{tikzpicture}


