1
\documentclass[11pt,a4paper,bibtotoc,idxtotoc,headsepline,footsepline,footexclude,BCOR12mm,DIV13]{scrbook}

\usepackage{pgfplots} 

\begin{document}

\begin{figure}
    \centering
    \begin{tikzpicture}
        \begin{semilogyaxis}[
            symbolic x coords={6, 7, 8, 9},
            xtick=data
          ]
            \addplot[ybar,fill=blue] coordinates {
                (6,   0.046566)
                (7,   0.043182)
                (8,   0.044373)
                (9,   0.045699)
            };
            \addlegendentry{TacoCompile};
            \addplot[ybar,fill=green] coordinates {
                (6,   0.000033)
                (7,   0.000032)
                (8,   0.000033)
                (9,   0.000033)
            };
            \addlegendentry{TacoAssemble};
            \addplot[ybar,fill=red] coordinates {
                (6,   0.000252)
                (7,   0.002509)
                (8,   0.024016)
                (9,   0.304340)
            };
            \addlegendentry{TacoCompute};
        \end{semilogyaxis}
    \end{tikzpicture}
    \caption{Evaluation of tensor-chain-multiplication on 5 tensors}
    \label{fig:tenChainEval}
\end{figure}

\end{document}

fail

EDIT: i would like to have the bars completely viseble side by side.

1 Answer 1

2

You probably want to use ybar for your axis options, and not for the plots themselves. I also do not know if "fully visible" refers to the legend, which I moved out.

    \documentclass[11pt,a4paper,bibtotoc,idxtotoc,headsepline,footsepline,footexclude,BCOR12mm,DIV13]{scrbook}

\usepackage{pgfplots} 
\pgfplotsset{compat=1.16}
\begin{document}

\begin{figure}
    \centering
    \begin{tikzpicture}
        \begin{semilogyaxis}[ybar,
            symbolic x coords={6, 7, 8, 9},xtick=data, 
            legend style={at={(0.5,1.02)},anchor=south}
          ]
            \addplot[fill=blue] coordinates {
                (6,   0.046566)
                (7,   0.043182)
                (8,   0.044373)
                (9,   0.045699)
            };
            \addlegendentry{TacoCompile};
            \addplot[fill=green] coordinates {
                (6,   0.000033)
                (7,   0.000032)
                (8,   0.000033)
                (9,   0.000033)
            };
            \addlegendentry{TacoAssemble};
            \addplot[fill=red] coordinates {
                (6,   0.000252)
                (7,   0.002509)
                (8,   0.024016)
                (9,   0.304340)
            };
            \addlegendentry{TacoCompute};
        \end{semilogyaxis}
    \end{tikzpicture}
    \caption{Evaluation of tensor-chain-multiplication on 5 tensors}
    \label{fig:tenChainEval}
\end{figure}

\end{document}

enter image description here

Or upwards facing bars.

\documentclass[11pt,a4paper,bibtotoc,idxtotoc,headsepline,footsepline,footexclude,BCOR12mm,DIV13]{scrbook}

\usepackage{pgfplots} 
\pgfplotsset{compat=1.16}
\begin{document}

\begin{figure}
    \centering
    \begin{tikzpicture}
        \begin{axis}[ybar,ymode=log,log origin=infty,
            symbolic x coords={6, 7, 8, 9},xtick=data, 
            legend style={at={(0.5,1.02)},anchor=south}
          ]
            \addplot[fill=blue] coordinates {
                (6,   0.046566)
                (7,   0.043182)
                (8,   0.044373)
                (9,   0.045699)
            };
            \addlegendentry{TacoCompile};
            \addplot[fill=green] coordinates {
                (6,   0.000033)
                (7,   0.000032)
                (8,   0.000033)
                (9,   0.000033)
            };
            \addlegendentry{TacoAssemble};
            \addplot[fill=red] coordinates {
                (6,   0.000252)
                (7,   0.002509)
                (8,   0.024016)
                (9,   0.304340)
            };
            \addlegendentry{TacoCompute};
        \end{axis}
    \end{tikzpicture}
    \caption{Evaluation of tensor-chain-multiplication on 5 tensors}
    \label{fig:tenChainEval}
\end{figure}

\end{document}

enter image description here

2
  • Thank you, this helped alot, i thought those scaled upwards, not downwards ... looks much better now, thank you Commented May 9, 2019 at 13:23
  • 2
    @CleboSevic In order to have the bars "grow up" you need to add log origin=infty. I added an example that does that.
    – user121799
    Commented May 9, 2019 at 13:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .