Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am having a problem with the following code for generating a plot. I don't know why the first group (Yago) does not include the first entry (the blue one for Sys1) and the second group does not include the last entry (the green one for Sys6). Any suggestions would be appreciated.

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
    \begin{tikzpicture}
         \begin{axis}[
                major x tick style = transparent,
            xtick=data,
                ybar,
                ymin = 0,
                ymax = 100,
            ymajorgrids = true,
            ylabel = {Offline Time (in min.)},
                xlabel = {Data Set},
                symbolic x coords = {Yago,DBLP},
                ytick = {0,20,40,60,80,100},
                scaled y ticks = false,
            bar width=10pt,
            ]
            \addplot coordinates {(Yago,20) (DBLP,12)};
            \addplot coordinates {(Yago,45) (DBLP,30)};
            \addplot coordinates {(Yago,30) (DBLP,15)};
            \addplot coordinates {(Yago,65) (DBLP,45)};
            \addplot coordinates {(Yago,25) (DBLP,14)};
            \addplot coordinates {(Yago,35) (DBLP,25)};

            \legend{Sys1,Sys2,Sys3,Sys4,Sys5,Sys6}

        \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

share|improve this question
    
Thanks for getting rid of the extra space. Can you please tell me how you accomplished that? I crop the picture using Acrobat, but it still shows that darn additional space. Thanks. –  ozsu Oct 6 '12 at 15:17
    
You're welcome :) I used gimp to crop the space –  cmhughes Oct 6 '12 at 16:44
    
@ozsu: Could you change your question title to be more descriptive? That will make it easier for others with the same problem to find the solution. –  Jake Oct 6 '12 at 21:04
add comment

1 Answer

up vote 6 down vote accepted

The bars are there, but there's not enough room for them to appear: you can use enlarge x limits and/or decrease the bar width:

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
    \begin{tikzpicture}
         \begin{axis}[
                major x tick style = transparent,
            xtick=data,
                ybar,
                ymin = 0,
                ymax = 100,
            ymajorgrids = true,
            ylabel = {Offline Time (in min.)},
                xlabel = {Data Set},
                symbolic x coords = {Yago,DBLP},
                ytick = {0,20,40,60,80,100},
                scaled y ticks = false,
            bar width=6pt,
            enlarge x limits=0.25,
            ]
            \addplot coordinates {(Yago,20) (DBLP,12)};
            \addplot coordinates {(Yago,45) (DBLP,30)};
            \addplot coordinates {(Yago,30) (DBLP,15)};
            \addplot coordinates {(Yago,65) (DBLP,45)};
            \addplot coordinates {(Yago,25) (DBLP,14)};
            \addplot coordinates {(Yago,35) (DBLP,25)};

            \legend{Sys1,Sys2,Sys3,Sys4,Sys5,Sys6}

        \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
Thank you very much. –  ozsu Oct 6 '12 at 15:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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