# pgfplots and exp(x) throws error: Dimension too large

I hope, someone can help me. I've the following problem:

I want to draw a Graph like this

The picture shows the following graphs: exp(x), ln(x), x

my code is:

\begin{tikzpicture}
\draw[ultra thin,color=gray] (-0.1,-0.1) grid (5,5);
\draw[->] (-0.2,0) -- (5.2,0) node[below] {$x$};
\draw[->] (0,-0.2) -- (0,5.2) node[above] {$y$};

\draw (0,0)--(5,5);

\draw[color=blue, samples=150, thick, domain=0:1.6095]
plot (\x,{exp(\x r)}) node[right] {$f(x) = exp x$};
\draw[color=cyan, samples=150, thick, domain=1:5]
plot (\x,{ln(\x r)}) node[right] {$f(x) = ln x$};
\end{tikzpicture}


My LaTeX Compliler throws me the follwoing message:

plot (\x,{exp(\x r)})

node[right] {$f(x) = exp x$}; I can't work with sizes bigger than about 19 feet. Continue and I'll use the

largest value I can.

The Domain Value for exp(x) is 1.6095 because exp(1.6095) = 5

I hope, you can help me.

-

## migrated from stackoverflow.comMay 5 '12 at 12:57

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner May 5 '12 at 14:25

In your question title it mentions pgfplots but you don't use it. And if you don't use r(radian) indicator everything runs smoothly. I'll take the easy way out by just giving a simple pgfplots example.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xmin=-0.5,xmax=5,ymin=-0.5,ymax=5,no markers,samples=50,grid=both]

Please see the pgfplots manual for a lot more.