2

I want to create this graph:

enter image description here

The graph is from a scientific paper which I want to quote in my master thesis. As it looks nicer if I create the graph myself than inserting it as a picture, I need your help

I don't know how to separate the graphs like in the picture and give them different headers.

\usepackage{pgfplots}


\begin{figure}[H]
\centering
\begin{tikzpicture}
\begin{axis}[
ybar,
width=\textwidth,
bar width=6mm,
ylabel={Conservation impact (\%)},
symbolic x coords={Newfoundland Power, Hydro One TOU 1, Hydro One RTM, BC Hydro, Woodstock Hydro, SRP, Country Energy, Hydro One TOU 2},
xtick =data,
x tick label style={rotate=90,anchor=east},
]
\addplot coordinates {(Newfoundland Power, 18) (Hydro One TOU 1, 6.8)(Hydro One RTM, 6.4)(BC Hydro, 2.8)(Woodstock Hydro, 15)(SRP, 12.9)(Country Energy, 8)(Hydro One TOU 2, 6.8)};
\end{axis}
\end{tikzpicture}
\end{figure}
1

Here's one possibility:

enter image description here

The code:

\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
\usetikzlibrary{calc}

\definecolor{barblue}{RGB}{120,211,255}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
  ybar,
  width=1.6\textwidth,
  height=13cm,
  bar width=12mm,
  ymajorgrids=true,
  grid style={dashed,help lines,gray!50},
  ylabel={Conservation impact (\%)},
  symbolic x coords={Newfoundland Power, Hydro One TOU 1, Hydro One RTM, BC Hydro, , Woodstock Hydro, SRP, , Country Energy, Hydro One TOU 2},
  xtick =data,
  x tick label style={rotate=90,anchor=east},
]
\addplot[fill=barblue] coordinates {(Newfoundland Power, 18) (Hydro One TOU 1, 6.8)(Hydro One RTM, 6.4)(BC Hydro, 2.8)(Woodstock Hydro, 15)(SRP, 12.9)(Country Energy, 8)(Hydro One TOU 2, 6.8)};
\draw[help lines,gray!50] 
  ( $ (axis cs:BC Hydro,0)!0.5!(axis cs:Woodstock Hydro,0) $ ) -- 
  ( $ (axis cs:BC Hydro,20)!0.5!(axis cs:Woodstock Hydro,20) $ );
\draw[help lines,gray!50] 
  ( $ (axis cs:SRP,0)!0.5!(axis cs:Country Energy,0) $ ) -- 
  ( $ (axis cs:SRP,20)!0.5!(axis cs:Country Energy,20) $ );
\node[anchor=north,yshift=-10pt,text=red] at
  ( $ (axis cs:Hydro One TOU 1,20)!0.5!(axis cs:Hydro One RTM,20) $ ) 
  {IHD-Only Impacts};  
\node[anchor=north,yshift=-10pt,text=red,align=center] at
  ( $ (axis cs:Woodstock Hydro,20)!0.5!(axis cs:SRP,20) $ ) 
  {IHD and Prepayment \\ Impacts};  
\node[anchor=north,yshift=-10pt,text=red,align=center] at
  ( $ (axis cs:Country Energy,20)!0.5!(axis cs:Hydro One TOU 2,20) $ ) 
  {IHD and Time-Varying Rates \\ Impacts};  
\end{axis}
\end{tikzpicture}

\end{document} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.