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 face a "filling" problem when I run one of the pgfplots example but with y-log scale. Here is the MWE

\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
  \begin{semilogyaxis}[ymin=0,ymax=1,enlargelimits=false]
    \addplot
      [const plot,fill=blue,draw=black]
      coordinates
        {(0,0.1)    (0.1,0.15)  (0.2,0.5)   (0.3,0.62)
         (0.4,0.56) (0.5,0.58)  (0.6,0.65)  (0.7,0.6)
         (0.8,0.58) (0.9,0.55)  (1,0.52)}
  \closedcycle;
  \end{semilogyaxis}
\end{tikzpicture}
\end{document}

Here is the output result

Here is the result

I also try to change the minimal value of y since logarithm of 0.0 is undefined but it does not help.

share|improve this question
    
Logarithmic bar plots are a Bad Idea: The zero point on a logarithmic plot is arbitrary, which defeats the whole idea of representing quantities using lengths. There's a nice discussion of this on bzintelguru.com/blog/…. A simple line plot is often more appropriate. –  Jake Nov 7 '12 at 17:55
    
@Jake I saw your answer in another topic. I get the point raised in the link but it really depends on what you want to see and to emphasize. In high energy particle physics, it is quite usual to show both the linear and logarithmic scale especially for low probability event. –  Xavier Garrido Nov 7 '12 at 23:37
    
Ah, that's interesting! Would you happen to have a reference to a paper at hand where a logarithmic bar chart is used, by any chance? –  Jake Nov 8 '12 at 7:36
    
arxiv.org/abs/1104.3716 but maybe this is what you call a simple line plot –  Xavier Garrido Nov 8 '12 at 8:46
add comment

1 Answer

up vote 2 down vote accepted

You can set the origin for logarithmic plots to always be at the bottom edge of the plot, by using log origin y=infty. This will affect the path drawn by \closedcycle, and define where plot styles like ybar and ycomb start. By default, the origin is set to log origin y=0.

\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
  \begin{semilogyaxis}[
    ymin=0.05,
    ymax=1,
    log origin=infty,
    enlargelimits=false
  ]
    \addplot
      [const plot,fill=blue,draw=black]
      coordinates
        {(0,0.1)    (0.1,0.15)  (0.2,0.5)   (0.3,0.62)
         (0.4,0.56) (0.5,0.58)  (0.6,0.65)  (0.7,0.6)
         (0.8,0.58) (0.9,0.55)  (1,0.52)}
  \closedcycle;
  \end{semilogyaxis}
\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.