I want to remove the white space between the bars corresponding to 'kkk' in the bar graph. Please advice. Code is give below
Note: Changing order of \addplot doesn't work, as it changes the meaning of plotted data.
\documentclass[10pt,journal,compsoc]{IEEEtran}
\usepackage{mathtools}
\usepackage{caption}
\usepackage{pgfplots}
\usepackage{hyperref}
\usepackage{subfig}
\usepackage{caption} \usetikzlibrary{fit,matrix,positioning,decorations.pathreplacing,calc,shapes,arrows,shadows,patterns}
\begin{document}
\begin{figure*}
\centering
\captionsetup{justification = centering}
\begin{tikzpicture}[scale =1.5, transform shape]
\begin{axis}[
major x tick style = transparent,
ybar = 2*\pgflinewidth,
bar width=10pt,
ymajorgrids = true,
symbolic x coords={ii, jj, kk},
xtick=data,
scaled y ticks = false,
enlarge x limits=0.35,
ymin=0,
minor y tick num=5,
xlabel style={yshift=-.3cm},
ylabel style={yshift=-.3cm},
tick label style={font=\footnotesize},
legend style={at={(.5,-0.1)}, anchor=north, /tikz/every even column/.append style={column sep=.2cm}},
legend columns = -1,
]
\addplot[style = {fill=blue, mark=none, postaction={pattern=dots}}, error bars/.cd, y dir=both, y explicit, error bar style ={thick}]
coordinates {
(ii, 53.980662) +- (0.443823296138724, 0.443823296138724)
(jj, 23.483776) +- (0.166719612668669, 0.166719612668669)
(kk, 131.7355) +- (2.47470029927319, 2.47470029927319)};
\addplot[style = {fill=yellow, mark=none, postaction={pattern=north east lines}}, error bars/.cd, y dir=both, y explicit, error bar style ={thick}]
coordinates {
(ii, 48.049724) +- (0.345152943568923, 0.345152943568923)
(jj, 20.135426) +- (0.181081482002146, 0.181081482002146)
(kk, 101.703804) +- (1.46905846775562, 1.46905846775562)};
\addplot[style = {fill=red, mark=none, postaction={pattern=horizontal lines}}, error bars/.cd, y dir=both, y explicit, error bar style ={thick}]
coordinates {
(ii, 99.82356) +- (2.50417124042843, 2.50417124042843)
(jj, 62.805482) +- (4.10531953309646, 4.10531953309646)};
\addplot[style = {fill=green, mark=none, postaction={pattern=vertical lines}}, error bars/.cd, y dir=both, y explicit, error bar style ={thick}]
coordinates {
(ii, 92.977176) +- (1.19822138752128, 1.19822138752128)
(jj, 63.35466) +- (1.52682237792326, 1.52682237792326)
(kk, 71.74764) +- (1.13940206252386, 1.13940206252386)
};
\legend{xxx, yyy, zzz, lll}
\coordinate (A) at (axis cs:ii, 40.961);
\coordinate (O1) at (rel axis cs:0,0);
\coordinate (O2) at (rel axis cs:1,0);
\draw [sharp plot,dashed, red, thick] (A -| O1) -- (A -| O2);
\end{axis}
\end{tikzpicture}
\end{figure*}
\end{document}


zzzvariable is zero. As you mentioned the order matters and that's why you get an empty spot there to show it. – percusse Jul 03 '18 at 07:27