TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to plot data with a logarithmic y-axis and restricting the y-data to a specified domain, but compilation fails for a reason I don't understand. This is the code:

\begin{axis}[ymode=log, restrict y to domain=1:6]
\addplot coordinates {(0, 1.1e1) (1, 1.7e3) (2, 0.0e0) (2, 3.4e7) (4, 8.1e5)};

Running it results in an error message:

! Missing number, treated as zero.
<to be read again> 
l.6 ..., 1.7e3) (2, 0.0e0) (2, 3.4e7) (4, 8.1e5)};

According to the pgfplots manual for version 1.5.1 (29 December 2011), page 272 (about restrict x/y/z to domain), For logarithmic axes, min and max are logs of the respective values. If I disable either the logarithmic y-axis or the domain-restriction, the code runs successfully and output is as expected (but not as desired).

Software versions:

  • pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011) (format=pdflatex 2012.5.30)
  • pgfplots 2011/12/29 v1.5.1 (git show 1.5.1-4-g53e640f )
  • tikz 2010/10/13 v2.10 (rcs-revision 1.76).

What's going on? What am I doing wrong? Or is this a bug?

share|improve this question
That does indeed seem like a bug, you might want to file a report on the pgfplots sourceforge site. As a workaround, you can use restrict expr to domain={y}{0:1e6}. – Jake Jun 5 '12 at 10:19

This is not a direct answer however it might help to get what you want to do. I also don't know why it doesn't work.

\begin{semilogyaxis}[restrict expr to domain={y}{10:1e6},unbounded coords=discard]
\addplot coordinates {(0, 1.1e1) (1, 1.7e3) (2, 1.0e0) (2, 3.4e7) (4, 8.1e5)};

If you remove the unbounded coords=discard it is set to jump.

enter image description here enter image description here

share|improve this answer

Your Answer


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.