10

The following MWE

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[ybar,ymode = log]
\addplot coordinates{
(1,1e-15)
(2,1e-14)
(3,1e-13)
};
\end{axis}
\end{tikzpicture}
\end{document}

compiles to this bar chart:

enter image description here

I'd like the bars to start from the bottom of the screen instead of the top, since it makes more sense to visualize my data like that (they are computational errors).

Is there a pgfplots option to achieve that? The manual only says that the bars always start from 0 (and there is no way to change that); clearly, when ymode=log this is interpreted as starting from log(1)=0, which is not what I want here.

Marijn
  • 37,699

1 Answers1

12

You can define where the "drawing origin" for logarithmic plots should be by setting log origin to either 0 or infty. If you set it to 0, which is the default, bar plots, comb plots and filled area plots will start from log(1)=0, so in this case the top of the plot. If you set it to infty, the plots will start from the bottom edge of the plot area, which is what you want in this case:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[ybar,ymode = log, log origin=infty]
\addplot coordinates{
(1,1e-15)
(2,1e-14)
(3,1e-13)
};
\end{axis}
\end{tikzpicture}
\end{document}
Jake
  • 232,450