# Problem with plot using pgfplots

I'm trying to plot the exponential function using pgfplots, but no matter what I change, I get only a part of the plot.

Here's the code (the code and the image were made using exp(0.25x) instead of exp(0.25x-5) but I get a similar result in both cases anyway):

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}

\begin{document}
\hspace{15mm}
\begin{tikzpicture}
\begin{axis}[xmin=-5,xmax=15,ymin=0,ymax=1,ylabel= $\mathbb{P}(x)$,xlabel=$x$,
no markers,samples=100,grid=both]
\end{axis}
\end{tikzpicture}
\end{document}


And here's the plot I get: Adding domain=-5:15 solves the issue for both functions: ## Notes:

• I am not sure why pgfplots did not just extract the domain from xmin and xmax.

## Code:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}

\begin{document}
\hspace{15mm}
\begin{tikzpicture}
\begin{axis}[xmin=-5,xmax=15,ymin=0,ymax=1,ylabel= $\mathbb{P}(x)$,xlabel=$x$,
no markers,samples=100,grid=both,domain=-5:15]
\addplot+ [ultra thick] {1/(1+exp(0.25*x))};
\addplot+ [ultra thick] {1/(1+exp(0.25*x-5))};

\end{axis}
\end{tikzpicture}
\end{document}

• Thanks! That was the problem, I didn't know I had to indicate the domain. Thanks again. – Raul Sep 30 '14 at 1:22