The middle between the symbolic values 8 and 11 can be used:
\path
(axis cs:8, \pgfkeysvalueof{/pgfplots/ymin})
-- coordinate (tmpmin)
(axis cs:11, \pgfkeysvalueof{/pgfplots/ymin})
(axis cs:8, \pgfkeysvalueof{/pgfplots/ymax})
-- coordinate (tmpmax)
(axis cs:11, \pgfkeysvalueof{/pgfplots/ymax})
;
\draw[thick, dashed] (tmpmin) -- (tmpmax);
Full example file (unrotated):
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ybar,
bar width=4pt,
width=23cm,
height=15cm,
ylabel=Absorbance,
enlargelimits=0.1,
legend style={at={(0.5,-0.15)},anchor=north,legend columns=-1},
symbolic x coords=
{5, 7, 8, 11, 14, 15, 20, 30, 32, 36, 37, 43, 44, 47, 56, 58},
xtick=data,
]
\addplot coordinates {(5, 0.887)(7, 0.961)(8, 0.65)(11, 0.849)(14, 0.886)(15, 0.908)(20, 0.797)(30, 0.607)(32, 0.887)(36, 0.961)(37, 0.65)(43, 0.849)(44, 0.886)(47, 0.908)(56, 0.797)(58, 0.607)};
\addplot coordinates {(5, 0.9)(7, 0.958)(8, 0.58)(11, 0.837)(14, 0.889)(15, 0.922)(20, 0.828)(30, 0.603)(32, 0.9)(36, 0.958)(37, 0.58)(43, 0.837)(44, 0.889)(47, 0.922)(56, 0.828)(58, 0.603)};
\addplot coordinates {(5, 0.066)(7, 0.106)(8, 0.056)(11, 0.05)(14, 0.052)(15, 0.064)(20, 0.056)(30, 0.1)(32, 0.066)(36, 0.106)(37, 0.056)(43, 0.05)(44, 0.052)(47, 0.064)(56, 0.056)(58, 0.1)};
\addplot coordinates {(5, 0.649)(7, 0.391)(8, 0.278)(11, 0.82)(14, 0.828)(15, 0.836)(20, 0.808)(30, 0.85)(32, 0.649)(36, 0.391)(37, 0.278)(43, 0.82)(44, 0.828)(47, 0.836)(56, 0.808)(58, 0.85)};
\addplot coordinates {(5, 0.041)(7, 0.047)(8, 0.042)(11, 0.04)(14, 0.042)(15, 0.045)(20, 0.04)(30, 0.04)(32, 0.041)(36, 0.047)(37, 0.042)(43, 0.04)(44, 0.042)(47, 0.045)(56, 0.04)(58, 0.04)};
\path
(axis cs:8, \pgfkeysvalueof{/pgfplots/ymin})
-- coordinate (tmpmin)
(axis cs:11, \pgfkeysvalueof{/pgfplots/ymin})
(axis cs:8, \pgfkeysvalueof{/pgfplots/ymax})
-- coordinate (tmpmax)
(axis cs:11, \pgfkeysvalueof{/pgfplots/ymax})
;
\draw[thick, dashed] (tmpmin) -- (tmpmax);
\end{axis}
\end{tikzpicture}
\end{document}

A variant with TikZ library calc
:
\usetikzlibrary{calc}
...
\def\ymin{\pgfkeysvalueof{/pgfplots/ymin}}
\def\ymax{\pgfkeysvalueof{/pgfplots/ymax}}
\draw[thick, dashed]
($(axis cs:8, \ymin)!.5!(axis cs:11, \ymin)$) --
($(axis cs:8, \ymax)!.5!(axis cs:11, \ymax)$)
;
Best Answer
Note that
|
does not work with defaultOT1
font encoding (it comes out as an em dash). Comment out my\usepackage[T1]{fontenc}
, recompile, and see.The most versatile would be
\mybar
, which you define as a\rule
of specified dimensions in the preamble.The math versions include
\vert
,|
, and\mid
.Lastly, variants can be applied to
\vert
and|
in the form of\big
,\bigg
,\Big
, and\Bigg
; however, this will mess up line spacing when used inline.For comparison, here is using a few "big" variants, as well as
OT1
encoding.