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.

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.

share|improve this question
1  
You can set log origin=infty to make the bars start from the bottom. –  Jake Dec 12 '12 at 10:26
    
Ah, thanks, I missed that on the manual! Wish to post it as an answer for me to accept it? –  Federico Poloni Dec 12 '12 at 10:38
add comment

1 Answer

up vote 2 down vote accepted

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}
share|improve this answer
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.