0

I would like to plot the following surface (it coincides with the xy-plane "behind" the back slopes of the parabolas).

My problem is that I don't know how to plot the straight lines in my drawing well. Perhaps this is easily doable with a some loop? All I know how to do is plot the parabola curves. I have included the code doing that below.

enter image description here

\documentclass{scrartcl}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=center, view={210}{50}] \addplot3[variable=t,mesh,domain=-4:4] (t,{ (1/2)*t^2}, 0);
\addplot3[variable=t,mesh,domain=-2:2] (t,{ 2*t^2}, 0);
\addplot3[variable=t,mesh,domain=-2:2] (t,{ 2*t^2}, {abs(t)});
\end{axis}
\end{tikzpicture}
\end{document}
4

It would have been much easier if pgfpots did not delay its expansions.

\documentclass{scrartcl}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=center, view={210}{50}] 
\addplot3[variable=t,mesh,domain=-4:4] (t,{ (1/2)*t^2}, 0);
\addplot3[variable=t,mesh,domain=-2:2] (t,{ 2*t^2}, 0);
\addplot3[variable=t,mesh,domain=-2:2] (3*t,{ 2*t^2}, {abs(t)});
\addplot3[variable=t,mesh,domain=-2:2] (5*t,{ 2*t^2}, 0);
\foreach \Z in {1,...,8}
{\def\Y{\Z}\relax
\pgfmathsetmacro{\X}{sqrt(2*\Y)}\relax
\edef\temp{\noexpand\draw[-] (axis cs:\X,\Y,0) -- (axis cs:3*\X/2,\Y,\X/2);}
\temp
\edef\temp{\noexpand\draw[-] (axis cs:-\X,\Y,0) -- (axis cs:-3*\X/2,\Y,\X/2);}
\temp
\edef\temp{\noexpand\draw[-] (axis cs:-\X,\Y,0) -- (axis cs:\X,\Y,0);}
\temp
\edef\temp{\noexpand\draw[-] (axis cs:2.5*\X,\Y,0) -- (axis cs:3*\X/2,\Y,\X/2);}
\temp
\edef\temp{\noexpand\draw[-] (axis cs:-2.5*\X,\Y,0) -- (axis cs:-3*\X/2,\Y,\X/2);}
\temp
}
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.