# Parabolic Cylinder

I am trying to produce a 3D parabolic cylinder but don't have the right technique. Please help

\begin{figure}[h]
\begin{center}
\tdplotsetmaincoords{70}{110}
\begin{tikzpicture}[scale=1,tdplot_main_coords]
\draw[thick,black,->] (0,0,0) -- (3,0,0) node[anchor=north east]{$x$};
\draw[thick,black,->] (0,0,0) -- (0,3,0) node[anchor=north west]{$y$};
\draw[thick,black,->] (0,0,0) -- (0,0,4.5) node[anchor=south]{$z$};
\draw [blue,thick,dashed, domain=-2:2, samples=100] plot (\x,-2,\x*\x);
\draw [blue,thick,dashed, domain=-2:2, samples=100] plot (\x,-1,\x*\x);
\draw [blue,thick,dashed, domain=-2:2, samples=100] plot (\x,1,\x*\x);
\draw [blue,thick,dashed, domain=-2:2, samples=100] plot (\x,2,\x*\x);
%\draw [fill=blue!40, domain=-2:2, samples=100,opacity=.2] plot (\x,-2,\x*\x)--(2,2,4)--(-2,2,4)--(-2,-2,4);
%\draw [blue,thick,fill=blue!40, domain=2:-2, samples=100,opacity=.2] plot (\x,2,\x*\x)--(2,-2,4);
%\draw [fill=blue!40, domain=-2:2, samples=100,opacity=.2] plot (\x,2,\x*\x);
\end{tikzpicture}
\end{center}
\caption{}
\end{figure}

• Hello ! Welcome on TeX ! Please have a look on tex.meta.stackexchange.com/questions/1436/welcome-to-tex-sx and give us a MWE – flav May 7 '18 at 6:03

You can fill using something like plot ... -- plot .....

To not repeat myself I defined two styles. The style to parabola is needed because tikz can't parse something like -- [...] but can parse -- plot ....

\documentclass[tikz,border=7pt]{standalone}
\tikzset{
parabola/.style args={#1:#2:#3}{
insert path={plot[domain=#1:#2] (\x,#3,\x*\x)}
},
to parabola/.style args={#1:#2:#3}{
insert path={ -- plot[domain=#1:#2] (\x,#3,\x*\x)}
},
}
\begin{document}
\begin{tikzpicture}
% axes
\draw[thick,black,->] (0,0,0) to (3,0,0) node[below left]{$x$};
\draw[thick,black,->] (0,0,0) to (0,3,0) node[below right]{$y$};
\draw[thick,black,->] (0,0,0) to (0,0,4.5) node[below]{$z$};
% plot some parabolas
\foreach \y in {-2,-1,...,2}
\draw[blue,thick,dashed,samples=100,parabola={-2:3:\y}];
% fill between the first and the last parabola
\def\t{1.3}% found by trial and error
\fill[blue, fill opacity=.1] [parabola={-2:\t:-2}] [to parabola={\t:-2:2}];
\fill[blue, fill opacity=.1] [parabola={\t:3:-2}] [to parabola={3:\t:2}];
\end{tikzpicture}
\end{document}


Note: I changed the domain from [-2:2] to [-2:3].

• This is exactly what I wanted below but your program helped tremendously. I'd like to adapt the program for a circular cylinder such as $x^{2}+y^{2}=1$ or $y^{2}+z^{2}=1$; and an ellipsoid: x^{2}+y^{2}/9+z^{2}/4 =1 . – MathScholar May 7 '18 at 15:24
• Not sure how to post my example/ adaptation yet. I am new here – MathScholar May 7 '18 at 15:28
• @MathScholar Drawing circular cylinder is much easier : two ellipses a two lines. The ellipsoid is actually a filled single ellipse and three or more drawn ellipses to represent the equators. In both cases you do not need plot. – Kpym May 7 '18 at 15:36

\documentclass{article}

\usepackage{tikz,tikz-3dplot}
\begin{document}
\tikzset{
parabola/.style args={#1:#2:#3}{
insert path={plot[domain=#1:#2] (\x,#3,\x*\x)}
},
to parabola/.style args={#1:#2:#3}{
insert path={ -- plot[domain=#1:#2] (\x,#3,\x*\x)}
},
}
\tdplotsetmaincoords{70}{110}

\begin{tikzpicture}[scale=1,tdplot_main_coords]
\draw[thick,black,->] (0,0,0) -- (3,0,0) node[anchor=north east]{$x$};
\draw[thick,black,->] (0,0,0) -- (0,3,0) node[anchor=north west]{$y$};
\draw[thick,black,->] (0,0,0) -- (0,0,5) node[anchor=south]{$z$};
\foreach \y in {-2,-1,...,2}
\draw[blue,thick,dashed,samples=100,parabola={-2:2:\y}];
% fill between the first and the last parabola
\def\t{0}% found by trial and error
\fill[blue, fill opacity=.1] [parabola={-2:\t:-2}] [to parabola={\t:-2:2}];
\fill[blue, fill opacity=.1] [parabola={\t:2:-2}] [to parabola={2:\t:2}];
\draw (-.5,-2.55,.25)--(-.5,1.45,.25);
\draw (-1,-2.85,1)--(-1,1.15,1);
\draw (-1.5,-3.2,2.25)--(-1.5,.8,2.25);
\end{tikzpicture}
\end{document}

• It is not clear what you want to do with your own answer. 1) Your code should be indented (there is a button for this), 2) Your code should be "compilable", 3) It is a good practice to add an image. – Kpym May 7 '18 at 18:57
• You should be able to compile this. How do I add the image? – MathScholar May 8 '18 at 0:50
• I found a way to add an image – MathScholar May 8 '18 at 1:06
• To generate the image you can check this question and to display correctly the code, it should be indented (select it and click the {} button). I made it for you this time. – Kpym May 8 '18 at 6:42