I would like to add significance bars (as depicted in the image below) for the pgfplot barplot that I coded. I have so far worked with "nodes", just adding asterisks but bars would be preferred.
Thank you for your help :-)
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.7}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{wrapfig}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
}
\usepackage{lipsum}
\title{Example}
\author{Name }
\date{April 2021}
\begin{document}
\maketitle
\section{Introduction}
\begin{figure*}[ht]
\centering
\resizebox{\textwidth}{!}{%
\begin{subfigure}[pt]{0.5\textwidth}
\begin{tikzpicture}
\begin{axis}[
ybar,
%bar width=.5cm,
domain=0:1,
every axis plot/.append style={no markers},
%xlabel=Timepoints (d),
ylabel= Frequency of Bursts,
width=\textwidth,
height=7cm,
ymax=6,
ymin=1,
xmin=-0.5,
xmax=1.5,
xticklabels={DIV15, DIV17},xtick={0,1},
x tick label style={rotate=90},
legend style={at={(0.025,0.875)},anchor=west,legend columns=2}]
%NMC
%NMC
\addplot+[fill,error bars/.cd,
y dir=both,y explicit]
coordinates {%NmC H
(0,3.7) +- (0.17,0.17)
(1,4.2) +- (0.28,0.28)
};
\addplot+[fill,error bars/.cd,
y dir=both,y explicit]
coordinates {%aS L
(0,3.3) +- (0.4,0.4)
(1,3.4) +- (0.25,0.25)
};
\addplot+[fill,error bars/.cd,
y dir=both,y explicit]
coordinates {%NmC H
(0,3.7) +- (0.17,0.17)
(1,4.1) +- (0.18,0.18)
};
\addplot+[fill,error bars/.cd,
y dir=both,y explicit]
coordinates {% aS H
(0,2.3) +- (0.1,0.1)
(1,3.1) +- (0.35,0.35)
};
%NMC
%NMC
%\node [above, font=\Large] at (axis cs: 0.21,300) {$\ast$};
%\node [above, font=\Large] at (axis cs: 1.21,265) {$\ast$};
\legend{\scriptsize{NmCherry L},\scriptsize{$\alpha$-syn L},\scriptsize{NmCherry H},\scriptsize{$\alpha$syn H}}
\end{axis}
\end{tikzpicture}
%\caption{Cell viability post-treatment}
%\label{fig:sub1}
\end{subfigure}
\hspace{8mm}
\begin{subfigure}[pt]{0.5\textwidth}
\begin{tikzpicture}
\begin{axis}[
ybar,
%bar width=.5cm,
domain=0:1,
every axis plot/.append style={no markers},
%xlabel=Timepoints (d),
ylabel= % of Active Neurones,
width=\textwidth,
height=7cm,
ymax=80,
ymin=10,
xmin=-0.5,
xmax=1.5,
xticklabels={DIV15, DIV17},xtick={0,1},
x tick label style={rotate=90},
legend style={at={(0.45,0.78)},anchor=west}]
%# of BURSTS
%# of BURSTS
\addplot+[fill,error bars/.cd,%NmC L
y dir=both,y explicit]
coordinates {
(0,58) +- (3.7,3.7)
(1,65) +- (1.9,1.9)
};
\addplot+[fill,error bars/.cd,%aS L
y dir=both,y explicit]
coordinates {
(0,30) +- (3.4,3.4)
(1,51) +- (2.9,2.9)
};
\addplot+[fill,error bars/.cd,%NmC H
y dir=both,y explicit]
coordinates {
(0,57) +- (4.2,4.2)
(1,60) +- (3.5,3.5)
};
\addplot+[fill,error bars/.cd,%aS H
y dir=both,y explicit]
coordinates {
(0,19) +- (2.9,2.9)
(1,39) +- (3.8,3.8)
};
%\node [above, font=\Large] at (axis cs: 0.21,2.8) {$\ast$};
%\node [above, font=\Large] at (axis cs: 1.21,3.6) {$\ast$};
%# of BURSTS
%# of BURSTS
%\legend{\scriptsize{NmCherry$^{+}$-Low},\scriptsize{$\alpha$syn-NmC$^{+}$-Low},\scriptsize{NmCherry$^{+}$-High},\scriptsize{$\alpha$syn-NmC$^{+}$-High}}
\end{axis}
\end{tikzpicture}
%\caption{Network burst activity post-treatment}
%\label{fig:sub1}
\end{subfigure}}
%\decoRule \
\caption[]{\
%\decoRule \
\footnotesize{\textit{.}}}
\label{fig:3.52}
\end{figure*}
\end{document}

