2

I have below bar-chart. I want to group the bars together by color. It makes no sense to compare the bins directly, but only the values with the same color directly. Is there a way to create two sub-bar-charts in the same chart area. Such as "left side only the blue bars", "right side only the red bars".

I create the graphic currently this way

\begin{tikzpicture}
        \begin{axis}[
          ybar,
          ymin=80,
          ymax=85,
          height=5cm,
          width=9cm,
          symbolic x coords={Baseline, +WebDict, +NewsDict},
          ylabel=Accuracies (test set),
          enlarge x limits=0.25,
          legend style={at={(-0.05,1.0)},
          anchor=west,legend columns=-1},
          nodes near coords,
          nodes near coords align={vertical},
          xtick=data
         ]
\addplot coordinates {(Baseline, 81.75) (+WebDict, 83.153) (+NewsDict, 83.16)};
\addplot coordinates {(Baseline, 83.02) (+WebDict,84.90) (+NewsDict,83.35)};

\addlegendentry[align=left]{English}
\addlegendentry[align=left]{German}   
\end{axis}
\end{tikzpicture}

enter image description here

  • You could generate two distinct axes positioned side by side: the first would only contain the first \addplot (blue bars) and the second axis the second plot (red bars). This would also allow you to add x axis descriptions (which appear to be of importance in your case) – Christian Feuersänger Jan 10 '15 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.