tikzpgfplots

Bar plot with logarithmic y axis in PGFPlots: how to shift bar bottoms


I want to make a bar plot in PGFPlots with a logarithmic y axis. The issue I have is that the bar bottoms are drawn relative to 10^0, when I want the bottoms at something below ymin. See below:

enter image description here

In other words, there should be no gap between the bottom x axis spine and the bars. Is there any way to accomplish this?

MWE:

\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
  \begin{semilogyaxis}
    \addplot+[ybar] coordinates {(0, 10) (1, 0.01)};
  \end{semilogyaxis}
\end{tikzpicture}
\end{document}

Solution

  • If I understand you correctly, you can use the log origin option, as suggested by this answer over on TeX.SE:

    \documentclass{standalone}
    \usepackage{pgfplots}
    \begin{document}
    \begin{tikzpicture}
      \begin{semilogyaxis}[log origin=infty]
        \addplot+[ybar] coordinates {(0, 10) (1, 0.01)};
      \end{semilogyaxis}
    \end{tikzpicture}
    \end{document}
    

    enter image description here