For this type of graph, I recommend using the pgfplots
package over tikz
, which is limited in terms of control over axis range and function domain. The code below should get you started with pgfplots
.
Edit: Use the minor x tick num = n
key (and equivalents for y- and z-axes) to specify how many minor ticks ('n', here) you want between two successive major ticks. Be mindful of potential off-by-one errors: n minor ticks translate to n+1 subintervals between two successive major ticks.
![enter image description here](https://i.stack.imgur.com/bN1OF.png)
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\begin{document}
\begin{tikzpicture}[scale=1.7]
\begin{axis}%
[
grid=major,
xtick={-7,-6,...,7},
minor x tick num=4, % 4 minor ticks => 5 subintervals
xmin=-6,
xmax=6,
xlabel={\scriptsize $x$},
axis x line=middle,
ytick={-5,-4,...,5},
minor y tick num=4, % 4 minor ticks => 5 subintervals
ymin=-3,
ymax=4,
ylabel={\scriptsize $f(x)$},
axis y line=middle,
no markers,
samples=100,
domain=-6:6,
]
\addplot (x,{-1/3*x^2});
\addplot (x,{1/6*x^2});
\addplot (x,{-x^2});
\addplot (x,{0.1*x^2});
\end{axis}
\end{tikzpicture}
\end{document}
Here is one attempt using tikz:
![enter image description here](https://i.stack.imgur.com/m7KXW.png)
The code:
\documentclass[border=5mm,tikz]{standalone}
\usepackage{mwe}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw(0,0)--(2,0)--(0,1)--(2,1)--(0,0);
\draw(0,3)--(2,3);
\draw[very thin, double distance=2pt](0.6,2.2)--(1.4,1.6);
\draw[very thin, double distance=2pt](0.6,1.6)--(1.4,2.2);
\foreach \y/\lab in {0/1,1/2,3/h} {
\filldraw(0,\y) circle[radius=2pt]node[left]{$v_{\lab}$};
}
\foreach \y/\lab in {0/n-h+1,3/n,-2/h+1} {
\filldraw(2,\y) circle[radius=2pt]node[right=3mm]{$v_{\lab}$};
}
\filldraw(2,1) circle[radius=2pt];
\node at (0,2) {$\vdots$};
\node at (2,2) {$\vdots$};
\node at (2,-1) {$\vdots$};
\draw[rounded corners] (1.7,-2.3) rectangle (2.3,3.3);
\end{tikzpicture}
\end{document}
Best Answer
You do not need anything special in order to plot the inverse function of a known function
f(x)
. To see this, recall that the plot off(x)
can be seen as a parametric plot ofCall now
x=f^{-1}(t)
. Then this plot will beFrom this it follows that a plot
is the same as
where we have, of course, to adjust the domains appropriately. So in order to plot
arctan(x)
(the pgf name of the function isatan
, see JairoAraujo' comment, oratan2
, which takes care of the quadrant), we can just plotand for
arccot
This is is illustrated in this MWE
The dashed red curve is just to show that "it works".
Of course, it makes a lot of sense to plot this with
pgfplots
.Or, per request without box and with a grid.