I am trying to increase the size of the legend such that it exactly fits to size of the plot. But even after having a look at the PGF manual I could not figure out how I can realise my plan. Afterwards I want to equally distribute the legend entries within the box.
UPDATE
The actual solution was:
\def\WIDTH{7cm}
\def\INNERSEP{3pt}
\begin{axis}[
xmin=1, xmax=10, xtick={1,...,10}, xmajorgrids=true, xlabel={Cores},
ymin=0, ymax=100, ymajorgrids=true, ylabel={MFLUPS/s},
scale only axis, % <==== !!!!!!!
extra description/.code={
\node[
draw,
text depth=0pt,
at={(current bounding box.north-|current axis.north)},
anchor=south,
text width=\WIDTH-2*\INNERSEP,
inner sep=\INNERSEP,
outer sep=0pt,
] {
\hbox to \linewidth{%
\hfill \ref{A} A \hfill \ref{B_B} B \hfill
}%
};
},
]
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat = newest}
\begin{document}
\pgfplotsset{width=7cm}
\begin{tikzpicture}
\begin{axis}[
xmin=1, xmax=10, xtick={1,...,10}, xmajorgrids=true, xlabel={Cores},
ymin=0, ymax=100, ymajorgrids=true, ylabel={MFLUPS/s},
legend style={
at={(current bounding box.north-|current axis.north)},
anchor=south,
legend columns=-1,
outer sep=0
}]
\addplot [mark=square*, mark options={solid}, thick] table {
1 10
2 20
3 30
4 40
5 50
6 65
7 70
8 80
9 90
10 95
};
\addlegendentry{Graph A}
\addplot [mark=*, mark options={solid}, thick] table {
1 10
2 20
3 25
4 40
5 25
6 65
7 70
8 25
9 90
10 95
};
\addlegendentry{Graph B}
\end{axis}
\end{tikzpicture}
\end{document}
