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.

Using groupplot library of PGFPlots, the command \nextgroupplot can take the parameters that \begin{axis} used to take. So giving it the option "ymode=log" should effectively make the plot a semilogyaxis plot. However I do get an error when I do that:

Missing number, treated as zero.

This is strange because it works find if I gave it xmode=log it runs without errors (although giving an empty plot instead).

The minimum running example follows:

\documentclass[11pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage{tikz}
\usepackage{pgfplots}

\usepgfplotslibrary{groupplots}

\begin{document}
  \begin{tikzpicture}[scale=0.6]
    \begin{groupplot}[ group style={group name=my plots, group size=2 by 1}, ymax=1, restrict y to domain=0:1]
      \nextgroupplot[ymode=log]%
      \addplot+[domain=0:6,mark=o,smooth,samples=20] {2^(-1)*exp(x)};%
      \addplot+[domain=0:6,mark=square,smooth,samples=20] {1-((1-2^(-1))/exp(x))};%

      \nextgroupplot%
      \addplot+[domain=0:6,mark=o,smooth,samples=20] {2^(-3)*exp(x)};%
      \addplot+[domain=0:6,mark=square,smooth,samples=20] {1-((1-2^(-3))/exp(x))};%
    \end{groupplot}
  \end{tikzpicture} 
\end{document}

The equations used to plot normally in a semilogyaxis, but I wanted them in a groupplot. So the function domain and so should not be the problem.

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

You mustn't restrict the domain for the y axes. The logarithm is not defined for zero. The following works for me.

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}

\begin{document}
  \begin{tikzpicture}[scale=0.6]
    \begin{groupplot}[%
      group style={%
        group name={my plots},
        group size=2 by 1
      },
      ymax=1,
%      restrict y to domain=0:1   % <<<<< This is not allowed
    ]
      \nextgroupplot[ymode=log]%
      \addplot+[domain=0:6,mark=o,smooth,samples=20] {2^(-1)*exp(x)};%
      \addplot+[domain=0:6,mark=square,smooth,samples=20] {1-((1-2^(-1))/exp(x))};%
      \nextgroupplot%
      \addplot+[domain=0:6,mark=o,smooth,samples=20] {2^(-3)*exp(x)};%
      \addplot+[domain=0:6,mark=square,smooth,samples=20] {1-((1-2^(-3))/exp(x))};%
    \end{groupplot}
  \end{tikzpicture}
\end{document}
share|improve this answer
    
Thank you :) .. ! –  M. Alaggan Jul 28 '11 at 16:55
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.