How to add vertical and horizontal lines to ybar figure and defining colors for bars?

I'm trying to reproduce a figure from a paper so it would be in line with the visual style of my paper. The figure I'm trying to reproduce is

Since originally posting I've found a way to define the colors of the ybars and to draw the vertical lines. I was able to do that thanks to this great example example. However, I'm having some difficulties with the horizontal lines. I do not know how I should refer to the x-axis coordinates. I have used the Label names for the x-axis but this doesn't allow me to draw the horizontal line so that it starts from the y-axis and goes all the way to the end. Currently my code is the following:

\documentclass{article}

\usepackage{pgfplots}
\pgfplotsset{compat=1.10}

\definecolor{RYB1}{RGB}{128, 177, 211}
\definecolor{RYB2}{RGB}{251, 128, 114}
\definecolor{RYB3}{RGB}{253, 180, 98}

\begin{document}

\begin{tikzpicture}
\pgfplotsset{width=10 cm}
\begin{axis} [
symbolic x coords={Label 1,Label 2, Label 3, Label 4, Label 5, Label 6, Label 7},
xtick={Label 1, Label 2, Label 3, Label 4, Label 5, Label 6, Label 7},
x tick label style={rotate=45, anchor=east, align=center},
axis lines*=left,
ymajorgrids = true,
y label style={rotate=-90},
ylabel=\Large{\textbf{\%}},
legend style={at={(0.5,-0.10)},
anchor=north,legend columns=1},
ymin=0,
ymax=175,
bar width=5mm,
ybar=-0.5cm,
enlarge x limits={abs=0.6cm},
nodes near coords,
every node near coord/.append style={color=black},
]
coordinates{ (Label 1,164) } ;
coordinates{ (Label 2,156) } ;
coordinates{ (Label 3,124) } ;
coordinates{ (Label 4,100) } ;
coordinates{ (Label 5,5) } ;
coordinates{ (Label 6,111) } ;
coordinates{ (Label 7,95) } ;
\draw [RYB3] (axis cs:Label 1,164) -- (axis cs:Label 7,164) ;
\draw [RYB3,->] (axis cs:Label 3,164) node [above] {-24 \%} -- (axis cs:Label 3,139) ;
\draw [RYB3,->] (axis cs:Label 4,164) node [above] {-39 \%} -- (axis cs:Label 4,115) ;
\draw [RYB3,->] (axis cs:Label 5,164) node [above] {-97 \%} -- (axis cs:Label 5,20) ;
\end{axis}
\end{tikzpicture}

\end{document}


This results in to a Figure that looks like this.

There are two issues with the picture. 1) I would like the horizontal line to start from the left end of the first bar and end at same point as the x-axis does. 2) The horizontal line goes over the second bar node (156).

Both of these issues could be resolved if I knew how to refer to the x-coordinates.

• – Jake
Aug 12 '14 at 20:24

You could change the xticklabels and plot using normal coordinates. I added a postaction to fill the background of 156 and the other labels with white color. I'm not very satisfied for my solution for the orange line, maybe you can improve it further.

\documentclass{article}

\usepackage{pgfplots}
\pgfplotsset{compat=1.10}
\usetikzlibrary{calc}

\definecolor{RYB1}{RGB}{128, 177, 211}
\definecolor{RYB2}{RGB}{251, 128, 114}
\definecolor{RYB3}{RGB}{253, 180, 98}

\begin{document}

\begin{tikzpicture}
\pgfplotsset{width=10 cm}
\begin{axis} [
xtick={1,...,7},
xticklabels={{Label 1},{Label 2},{Label 3},{Label 4},{Label 5},{Label 6},{Label 7}},
x tick label style={rotate=45, anchor=east, align=center},
axis lines*=left,
ymajorgrids = true,
y label style={rotate=-90},
ylabel=\Large{\textbf{\%}},
legend style={at={(0.5,-0.10)},
anchor=north,legend columns=1},
ymin=0,
ytick={0,20,...,200},
ymax=200,
bar width=5mm,
ybar=-0.5cm,
%enlarge x limits={abs=0.6cm},
nodes near coords,
every node near coord/.append style={postaction={fill=white,draw=none},color=black},%NOTE THE POSTACTION
xmin=.5,xmax=7.5
]
coordinates{ (1,164) } ;
coordinates{ (2,156) } ;
coordinates{ (3,124) } ;
coordinates{ (4,100) } ;
coordinates{ (5,5) } ;
coordinates{ (6,111) } ;
\draw[white] (axis cs:0.5,164) -- ($(axis cs:1,164)-(2.5mm,0)$);