Com o código a seguir, consigo desenhar uma parábola y=x^2, mas não consigo desenhar a parábola x=y^2, mostrando algum erro, por favor me ajude.
\documentclass{article}
\usepackage{tikz,pgfplots}
%\usepackage[x11names]{xcolor}
\usepackage{tikz}
\usetikzlibrary{intersections}
\pgfdeclarelayer{bg} % declare background
\pgfsetlayers{bg,main} % order of layers (main = standard layer)
\pgfplotsset{compat=1.13}
\usepackage{amsmath}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[domain=0:2, scale = 0.75]
\draw(-4,0)--(4,0);
\draw (0,-4)--(0,4);
\draw[black, line width = 0.50mm] plot[smooth,domain=-2:2] (\x, {(\x)^2});
\draw[black, line width = 0.50mm] plot[smooth,domain= -2:2] (\y, {(\y)^2});
\end{tikzpicture}
\end{document}
Responder1
Adicionar variable=\y
. O resultado é obviamente o mesmo.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[domain=0:2, scale = 0.75]
\draw(-4,0)--(4,0);
\draw (0,-4)--(0,4);
%\draw[black, line width = 0.50mm] plot[smooth,domain=-2:2] (\x, {(\x)^2});
\draw[black, line width = 0.50mm] plot[smooth,domain= -2:2,variable=\y] (\y, {(\y)^2});
\end{tikzpicture}
\end{document}
Você também pode chamar a variável plot \CuteFurryRodent
e ainda obterá
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[domain=0:2, scale = 0.75]
\draw(-4,0)--(4,0);
\draw (0,-4)--(0,4);
\draw[black, line width = 0.50mm]
plot[smooth,domain= -2:2,variable=\CuteFurryRodent] (\CuteFurryRodent, {(\CuteFurryRodent)^2});
\end{tikzpicture}
\end{document}
Você pode querer trocar os papéis de x e y,
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[domain=0:2, scale = 0.75]
\draw(-4,0)--(4,0);
\draw (0,-4)--(0,4);
\draw[black, line width = 0.50mm] plot[smooth,domain=-2:2] (\x, {(\x)^2});
\draw[blue,dashed, line width = 0.50mm] plot[smooth,domain= -2:2,variable=\y]
( {(\y)^2},\y);
\end{tikzpicture}
\end{document}
Também se pode usar parabola bend
aqui.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[domain=0:2, scale = 0.75]
\draw(-4,0)--(4,0);
\draw (0,-4)--(0,4);
\draw[black, line width = 0.50mm] (-2,4) parabola bend (0,0) (2,4);
\draw[blue,dashed, line width = 0.50mm,rotate=-90] (-2,4) parabola bend (0,0) (2,4);
\end{tikzpicture}
\end{document}