# pgfplots and subfigure

I'm using Springer LNCS template to create a paper, so that I can't use subcaption Using subfigure with pgfplots results in no aligning at all.

The code I use to draw plots:

\begin{figure}
\centering

\subfigure{
\begin{tikzpicture}
\begin{axis}[

ybar = 0pt,
scale = 0.6,
/pgf/number format/1000 sep={},
xticklabels={Bayes, Tree, kNN, SVM},
xtick = {1,2,3,4,5},
ymin = 0,
ymax = 100,
enlarge x limits=0.25,
legend cell align=left,
legend style={
at={(1,1.05)},
anchor=south east,
column sep=1ex
}
]
(1, 68) (2, 70) (3, 67) (4, 66)
};
(1, 70)     (2, 71) (3, 72) (4, 68)
};

\legend{unmodified, modified}
\end{axis}
\end{tikzpicture}
}

\subfigure{
\begin{tikzpicture}
\begin{axis}[
ybar=0pt,
scale = 0.6,
/pgf/number format/1000 sep={},
xticklabels={Bayes, Tree, kNN, SVM},
xtick = {1,2,3,4,5},
ymin = 0,
ymax = 100,
enlarge x limits=0.25,
legend cell align=left,
legend style={
at={(1,1.05)},
anchor=south east,
column sep=1ex
}
]
(1, 68) (2, 70) (3, 67) (4, 67)
};
(1, 68)     (2, 70) (3, 70) (4, 68)
};

\legend{unmodified, modified}
\end{axis}
\end{tikzpicture}
}

\subfigure{
\begin{tikzpicture}
\begin{axis}[
ybar=0pt,
scale = 0.6,
/pgf/number format/1000 sep={},
xticklabels={Bayes, Tree, kNN, SVM},
xtick = {1,2,3,4,5},
ymin = 0,
ymax = 100,
enlarge x limits=0.25,
legend cell align=left,
legend style={
at={(1,1.05)},
anchor=south east,
column sep=1ex
}
]
(1, 69) (2, 67) (3, 72) (4, 68)
};
(1, 70)     (2, 70) (3, 73) (4, 69)
};

\legend{unmodified, modified}
\end{axis}
\end{tikzpicture}
}
\caption{Genuineness}
\end{figure}


How can I fix it and display all the plots in one row?

EDIT Thanks to @percusse the issue was in empty lines. Now it looks okay.

• why can't you use subcaption? Notice that in any case don't use subfigure but at least subfig. And remove the empty lines in between they mean paragraphs – percusse Mar 6 '15 at 19:11
• @percusse Thank you very much! Indeed, the issue was connected with empty lines. I found answers on TeX exchange that LLNCS template doesn't support subcaption package, so I have to use another. – mgalkin Mar 6 '15 at 19:46
• Apparently I did something similar in a previous life using subcaption and llcns tex.stackexchange.com/questions/61824/… – percusse Mar 6 '15 at 19:53

You should avoid subfigure that has been obsolete for more than 15 years:

\usepackage[caption=false]{subfig}


is the call you should do.

I'm not sure what you need subfloats for, as you don't use subcaptions. So I'll add empty subcaptions for getting just the letters.

Notes:

1. you shouldn't have blank lines between the subfloats that you want side by side
2. you shouldn't have blank lines in the tikzpicture environments
3. this particular example would end up with an overfull line, so I left the third subfigure below the other two (just adding a blank line
\documentclass{llncs}
\usepackage[caption=false]{subfig}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}

\begin{document}

\begin{figure}
\centering

\subfloat[]{%
\begin{tikzpicture}
\begin{axis}[
ybar = 0pt,
scale = 0.6,
/pgf/number format/1000 sep={},
xticklabels={Bayes, Tree, kNN, SVM},
xtick = {1,2,3,4,5},
ymin = 0,
ymax = 100,
enlarge x limits=0.25,
legend cell align=left,
legend style={
at={(1,1.05)},
anchor=south east,
column sep=1ex
}
]
(1, 68) (2, 70) (3, 67) (4, 66)
};
(1, 70)     (2, 71) (3, 72) (4, 68)
};
\legend{unmodified, modified}
\end{axis}
\end{tikzpicture}%
}
\subfloat[]{%
\begin{tikzpicture}
\begin{axis}[
ybar=0pt,
scale = 0.6,
/pgf/number format/1000 sep={},
xticklabels={Bayes, Tree, kNN, SVM},
xtick = {1,2,3,4,5},
ymin = 0,
ymax = 100,
enlarge x limits=0.25,
legend cell align=left,
legend style={
at={(1,1.05)},
anchor=south east,
column sep=1ex
}
]
(1, 68) (2, 70) (3, 67) (4, 67)
};
(1, 68)     (2, 70) (3, 70) (4, 68)
};
\legend{unmodified, modified}
\end{axis}
\end{tikzpicture}%
}

\subfloat[]{%
\begin{tikzpicture}
\begin{axis}[
ybar=0pt,
scale = 0.6,
/pgf/number format/1000 sep={},
xticklabels={Bayes, Tree, kNN, SVM},
xtick = {1,2,3,4,5},
ymin = 0,
ymax = 100,
enlarge x limits=0.25,
legend cell align=left,
legend style={
at={(1,1.05)},
anchor=south east,
column sep=1ex
}
]
(1, 69) (2, 67) (3, 72) (4, 68)
};