La leyenda no aparece en el gráfico de barras

La leyenda no aparece en el gráfico de barras

Tengo un gráfico de barras donde algunos de los conjuntos de datos no contienen puntos para todas las coordenadas x.

Tengo dos problemas:

  1. Las etiquetas de leyendas no aparecen
  2. El símbolo de la leyenda es una doble barra. ¿Porqué es eso? ¿No debería ser una sola barra?

Además, dado que tengo mucho espacio vacío dentro del gráfico (esquina noroeste), ¿puedo poner la leyenda allí?

Gracias

\documentclass[preprint,1p,times]{elsarticle}

\usepackage{pgfplots}

\pgfplotsset{height=6cm, compat=1.9}

\begin{document}

\newcommand \SingleName {Single}
\newcommand \DoubleName {Double}
\newcommand \ScalarName {Scalar}
\newcommand \SSEName {SSE}
\newcommand \AVXName {AVX} 

\newcommand \MorinOffsetName {Khuong Offset}
\newcommand \MorinBranchyName {Khuong Branchy}
\newcommand \LowerBoundName{lower\_bound}
\newcommand \BitSetNoPadName{Lead Bit No Pad}
\newcommand \ClassicModName{Classic Mod}

\newcommand \ClassicName {Classic}
\newcommand \ClassicColor {magenta}
\newcommand \ClassicMark {*}
\newcommand \ClassicStyle {solid}

\newcommand \ClassicOffsetName {Offset}
\newcommand \ClassicOffsetColor {green}
\newcommand \ClassicOffsetMark {*}
\newcommand \ClassicOffsetStyle {solid}

\newcommand \BitSetName {Lead Bit}
\newcommand \BitSetColor {green}
\newcommand \BitSetMark {*}
\newcommand \BitSetStyle {solid}

\newcommand \EytzingerName {Eytzinger}
\newcommand \EytzingerColor {blue}
\newcommand \EytzingerMark {*}
\newcommand \EytzingerStyle {solid}

\pgfplotsset{every axis/.append style={
    font=\small,
        line width=0.6pt,
        }}


\begin{figure}[ht]
\begin{tikzpicture}
\begin{axis}[
    width  = 0.85\textwidth,
    height = 5cm,
    major x tick style = transparent,
    ybar=2.5*\pgflinewidth,
    bar width=2.5pt,
    ymajorgrids = true,
    ylabel = {Throughput},
    ytick={0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600},
    symbolic x coords={\ClassicName,\LowerBoundName,\MorinBranchyName,\MorinOffsetName, \ClassicModName,\ClassicOffsetName,\BitSetName,\EytzingerName},
    xtick = data,
    xticklabel style={rotate=45, anchor=east},
    scaled y ticks = false,
    enlarge x limits=0.08,
    ymin=0,
    legend pos=outer north east,
]

  \addplot[style={red,fill=red,mark=none}]
coordinates {(\EytzingerName,170.465) (\BitSetName,199.79) (\ClassicOffsetName,184.861) (\MorinOffsetName,146.236) (\MorinBranchyName,64.4379) (\ClassicName,53.0333) (\LowerBoundName,62.4723) (\ClassicModName,152.575) };
\addplot[style={orange,fill=orange,mark=none}]
coordinates {(\EytzingerName,171.929) (\BitSetName,199.421) (\ClassicOffsetName,187.638) (\MorinOffsetName,147.191) (\MorinBranchyName,63.5857) (\ClassicName,50.8408) (\LowerBoundName,63.7888) (\ClassicModName,153.149) };
\addplot[style={blue,fill=blue,mark=none}]
coordinates {(\EytzingerName,381.08) (\BitSetName,383.956) (\ClassicOffsetName,379.795) (\ClassicModName,244.268) };
\addplot[style={cyan,fill=cyan,mark=none}]
coordinates {(\EytzingerName,260.645) (\BitSetName,263.8) (\ClassicOffsetName,254.917) (\ClassicModName,151.602) };
\addplot[style={green,fill=green,mark=none}]
coordinates {(\EytzingerName,385.152) (\BitSetName,386.348) (\ClassicOffsetName,381.327) (\ClassicModName,253.413) };

\addplot[style={yellow,fill=yellow,mark=none}]
    coordinates {(\EytzingerName,264.892) (\BitSetName,216.624) (\ClassicOffsetName,214.466) (\ClassicModName,138.059) };

 \legend={\SingleName-\ScalarName,\DoubleName-\ScalarName,\SingleName-\SSEName,\DoubleName-\SSEName,\SingleName-\AVXName,\DoubleName-\AVXName}
 %   \legend={a,b,c,d,e,f}
\end{axis}

\end{tikzpicture}
\vspace*{-5mm}
\caption{Throughput in millions of searches per second with array X of size $N=15$ and array $Z$ of size $M=2048$ randomly generated}
\label{fig:selectbinary}
\end{figure}

\end{document}

ingrese la descripción de la imagen aquí

información relacionada