I would like to graph an exponential function and its inverse on the same Cartesian plane using TikZ (or pgfplots). I have code using TikZ. Apparently, there is an error in the `\addplot`

command.

I would like to plot y = 2^{x} and y = \log_{2}(x). (The code is for e^{x} and \ln(x). I was not sure how to enter "\log_{2}(x)" in TikZ.) The exponential function should be labeled "y = 2^{x}" towards the top, where its graph ends, and the logarithmic function should be labeled "y = \log_{2}(x)" towards the bottom, where its graph ends.

```
\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}[dot/.style={draw,fill,circle,inner sep=1pt}]
\draw[<->] (-7,0) -- (7,0) node[below]{$x$};
\draw[<->] (0,-7) -- (0,7) node[left]{$y$};
\draw[<->, dashed] (-6.5,-6.5) -- (6.5,6.5) node[right]{$y=x$};
\addplot [color=green] {exp(x)};
\addplot [color=blue] {ln(x)};
\end{tikzpicture}
\end{document}
```

## Best Answer

Here is a quick example;