2

I would like to ask you if you have something like graphs of elementary functions on one page made in TikZ. I write thesis and I would like to get inspired by your code and design. It would be very helpful.

Thank you!

goLK
  • 793
  • What are elementary functions? Are they in the spirit of Courant - Fritz John for example? Rational functions, trigonometric functions -- sin, cos etc., logarithm and the exponential? – kan Aug 31 '13 at 18:13
  • Yeah, you grasped it. It could be enough. Maybe arc sin, arc cos etc. – goLK Aug 31 '13 at 18:31
  • 2
    Try the pgfplots manual.It has a lot of inspirational examples. – yannisl Aug 31 '13 at 19:12
  • Maybe you'd like to have a look at my answer to this question: http://tex.stackexchange.com/questions/121794/how-to-plot-the-functions-in-tikz/121799#121799 It is quite similar. – Henri Menke Aug 31 '13 at 19:36
  • A template would be enough. It could help me. I imagine two or three graphs on textwidth. – goLK Aug 31 '13 at 19:46

1 Answers1

4

You can use the powerful pgfplots package; the documentation is full with examples for inspiration. Below a present just a small selection of graphs of trigonometric, exponential and rational functions. In the example I show different styles for the axis, ticks, labels, titles, descriptions, grids:

\documentclass{article}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{pgfplots}

\pgfplotsset{compat=1.8}
\tikzset{
every pin/.style={fill=yellow!50!white,rectangle,rounded corners=3pt},
small dot/.style={fill=black,circle,inner sep=1pt}
}

\pagestyle{empty}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
enlargelimits=false,
axis lines=middle,
xtick={-6.28318, -3.15159265, ..., 6.28318},
xticklabels={$-2\pi$,$-\pi$,0,$\pi$,$2\pi$},
grid=major,
legend style={legend pos=outer north east}
]
\addplot+[no marks,domain=-2*pi:2*pi, samples=100]{cos(deg(x))};
\addlegendentry{$f(x)=\cos(x)$}
\addplot+[no marks,domain=-2*pi:2*pi, samples=100]{sin(deg(x))};
\addlegendentry{$g(x)=\sin(x)$}
\end{axis}
\end{tikzpicture}\par\bigskip

\begin{tikzpicture}
\begin{axis}[
enlargelimits=false,
axis lines=middle,
legend style={legend pos=outer north east},
extra x ticks={2},
extra x tick style={grid=major}
]
\addplot+[no marks,domain=-8:12,unbounded coords=jump,samples=101]{(x-2)^(-1)};
\node[small dot,pin=60:{$f(x)=(x-2)^{-1}$}] at (axis cs:3,1) {};
\end{axis}
\end{tikzpicture}\par\bigskip

\begin{tikzpicture}
\begin{axis}[
xmin=0,
xmax=3,
ymin=0,
ymax=15,
samples=100,
extra y ticks={2.71828},
extra y tick labels={$e$},
title={Graph of $h(x)=e^{x}$}
]
\addplot[no marks,cyan] {exp(x)};
\draw[dashed] (axis cs:1,0) -- (axis cs:1,2.71828); 
\draw[dashed] (axis cs:0,2.71828) -- (axis cs:1,2.71828);
\node[small dot,fill=red] at (axis cs:1,2.71828) {};
\end{axis}
\end{tikzpicture}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128