pgfplot,将3个图形并排放置在一个坐标系中,并带有不同的标题

pgfplot,将3个图形并排放置在一个坐标系中,并带有不同的标题

我想要创建这个图表:

在此处输入图片描述

该图表来自一篇科学论文,我想在我的硕士论文中引用它。如果我自己创建图表,看起来比将其作为图片插入会更好,所以我需要你的帮助

我不知道如何像图片中那样分离图形并为它们提供不同的标题。

\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

有一种可能性是:

在此处输入图片描述

代码:

\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} 

相关内容