1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
\documentclass[a4paper]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{clickable}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xlabel=$x$,ylabel=$y$,
domain=-2:2,
samples=17,
legend style={at={(0.5,0.98)},anchor=north,legend columns=-1}
]
\addplot {x};
\addplot {x^2};
\addplot {x^3};
\legend{$x$,$x^2$,$x^3$}
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{semilogyaxis}[
xlabel=$x$,ylabel=$f(x)$,
samples=10,
domain=0:6,
legend style={at={(0.5,0.98)},anchor=north,legend columns=-1}
]
\addplot {exp(x)};
\addplot {10^x};
\legend{$\exp(x)$,$10^x$}
\end{semilogyaxis}
\end{tikzpicture}
\end{document}
|