1

Is it possible to produce a bar chart in pgfplots with no X labels? I'd like to simply fill the bars and have an external legend that provides a color code. I'm making a 3x1 group plot that shows the performance of several different algorithms under three different sets of assumptions, and so the X labels would just be repeated which starts to really crowd the space. But I can't seem to find anything about how to generate a bar chart with no X labels...

Here's a sort of MWE...

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
  \begin{figure}
    \centering
    \begin{tikzpicture}
        \begin{groupplot}[
                footonotesize,
                group style={
                group size=3 by 1,
                xlabels at=edge bottom,
                ylabels at=edge left
                }]
            \nextgroupplot[title={\scriptsize Empirical CDF}]
                \addplot[ybar] coordinates {
                    (1, 8.501)
                    (2, 10.179)
                    (3, 11.14)
                    (4, 15.001)
                    (5, 6.886)};
            \nextgroupplot[title={\scriptsize Triangular CDF}]
                \addplot[ybar] coordinates {
                    (1, 7.745)
                    (2, 8.606)
                    (3, 8.630)
                    (4, 15.001)
                    (5, 6.886)};
            \nextgroupplot[title={\scriptsize LN/Exponential CDF}]
                \addplot[ybar] coordinates {
                    (1, 8.428)
                    (2, 9.964)
                    (3, 11.087)
                    (4, 15.001)
                    (5, 6.886)};
        \end{groupplot}
    \end{tikzpicture}
    %\ref{CombinedLegendBar}
    \caption{Triage++ Performance}
    \label{PlusPlusCombinedBar}
  \end{figure}
\end{document}

It looks horrible at the moment :) I'm still figuring out pgfplots.

  • 1
    Is it possible to provide a MWE? ;-) – user31729 Apr 7 '15 at 10:37
  • OP edited to include a sort of MWE... – jerH Apr 7 '15 at 10:49
2

You can either use xtick=\empty or xticklabels=\empty. In first case both ticks and labels are gone while in the latter only labels are gone. Here I have put xticklabels=\empty.

\documentclass[border=2]{standalone}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.groupplots}
\begin{document}
    \begin{tikzpicture}
        \begin{groupplot}[
                group style={
                group size=3 by 1,
                xlabels at=edge bottom,
                ylabels at=edge left,                
                }]
            \nextgroupplot[title={\scriptsize Empirical CDF},xticklabels=\empty]
                \addplot[ybar] coordinates {
                    (1, 8.501)
                    (2, 10.179)
                    (3, 11.14)
                    (4, 15.001)
                    (5, 6.886)};
            \nextgroupplot[title={\scriptsize Triangular CDF},xticklabels=\empty]
                \addplot[ybar] coordinates {
                    (1, 7.745)
                    (2, 8.606)
                    (3, 8.630)
                    (4, 15.001)
                    (5, 6.886)};
            \nextgroupplot[title={\scriptsize LN/Exponential CDF},xticklabels=\empty]
                \addplot[ybar] coordinates {
                    (1, 8.428)
                    (2, 9.964)
                    (3, 11.087)
                    (4, 15.001)
                    (5, 6.886)};
        \end{groupplot}
    \end{tikzpicture}
\end{document}

enter image description here

  • Thanks! Now on to working out the legend! And the fills. And the error bars. :) – jerH Apr 7 '15 at 11:00

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.