Plotting an inverse function in Tikz without showing a grid

2 replies · 3K views · last reply
karush
Gold Member
MHB
Messages
3,240
Reaction score
5
ok I have been trying to cut and paste in packages and code to get a simple inverse function to plot
but nutin shows up and get error message.

if possible I would like no grid but an xy axis with tick only where the graph goes thru the axis
and of course a dashed line of x=y

some of the ones demonstrated in stackexchange had too much decorations

anyway

im using overleaf so fat everything that tikx is used here works there
 
Something like this?

\begin{tikzpicture}
%preamble \usepackage{pgfplots}
\begin{axis}[
axis lines=middle,
xmin=-1, xmax=2, ymin=-1, ymax=2
]
\addplot[help lines, dashed] (x, x);
\addplot[blue, smooth, ultra thick] (x, x*x);
\addplot[red, smooth, ultra thick] (x*x, x);
\end{axis}
\end{tikzpicture}

Code:
\begin{tikzpicture}
  %preamble \usepackage{pgfplots}
  \begin{axis}[
      axis lines=middle,
      xmin=-1, xmax=2, ymin=-1, ymax=2
    ]
    \addplot[help lines, dashed] (x, x);
    \addplot[blue, smooth, ultra thick] (x, x*x);
    \addplot[red, smooth, ultra thick] (x*x, x);
  \end{axis}
\end{tikzpicture}
 
Last edited:
That looks like what I want
I try it tomorrow

Mahalo