# How to plot $x^2+y^2 = 4$ and $z=2$ in 3-dimensional space in Latex

I'm trying to plot $x^2+y^2 = 4$ and $z=2$ in 3-dimensional space with axes labels.

I came across pgfplot and tikz-3dplot but I could not do it.

• Both in Tikz-3dplot and pgfplots this is just a circle of radius 2 in the xy plane at z=2. In tikz-3dplot you can use the key “canvas is currently plane at z=2” for that. If you need explicit examples, please let me know. – Schrödinger's cat Oct 12 at 16:35
• I am guessing the OP means a cylinder and a plane, and perhaps their intersections, simultaneously on a 3d system. – Maesumi Oct 15 at 18:20

This is just a circle of radius 2 in the xy plane at z=2. You can draw this circle both with tikz-3dplot and pgfplots. Here is a tikz-3dplot variant.

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{110}{70}
\begin{tikzpicture}[tdplot_main_coords]
\begin{scope}[canvas is xy plane at z=2] How this circle really is going to look depends on the view angles, which are specified by \tdplotsetmaincoords{110}{70} in the above example. You may only appreciate z=2 really after adding other stuff at different z position,