[Tex/LaTex] How to plot functions like ‎‎‎‎‎x=f(y)‎‎ using TikZ

tikz-pgf

To plot functions in the form of y=f(x), we simply write‎

‎\draw ‎[‎smooth,‎samples=100‎,domain=0:‎‎2‎‎] ‎plot(\x,‎‎‎‎‎‎‎‎{(\x)...‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎});‎‎

But how about functions like x=f(y)? How to plot them? How to specify their domains ‎in terms of "y"‎?

\documentclass{article}
\usepackage{tikz} 
\begin{document}
\begin{tikzpicture}
\draw [smooth,samples=100,domain=0:2] plot(???);
\end{tikzpicture}
\end{document}

Best Answer

\documentclass[tikz]{standalone}
\usepackage{tikz}

\begin{document}    
\begin{tikzpicture}
  \draw[->] (-3, 0) -- (4.2, 0) node[right] {$x$};
  \draw[->] (0, -3) -- (0, 4.2) node[above] {$y$};
  \draw[scale=0.5, domain=-3:3, smooth, variable=\x, blue] plot ({\x}, {\x*\x});
  \draw[scale=0.5, domain=-3:3, smooth, variable=\y, red]  plot ({\y*\y}, {\y});
\end{tikzpicture}
\end{document}

Graphs of the binary relations y = x^2 and x = y^2