1

I would like to draw a "nice" 2D ellipse in 3D space using tikz. I'm using the tikz packages and tikz library arrows.meta

\usepackage{tikz}
\usetikzlibrary{arrows.meta}

This is my code so far:

\begin{tikzpicture}[scale=2.0, line cap=round, line join=round, >=Triangle]
\draw [->] (0,-1.75) -- (0,1.75); %z
\draw [->] (0.81,1.05) -- (-0.81,-1.05); %x
\draw [->] (-2.35,0) -- (2.35,0); %y
\draw (-1.15,-1.01) node[anchor=north west] {\Large $ {x}$};
\draw (2.40,0.15) node[anchor=north west] {\Large $ {y}$};
\draw (-0.05,2.20) node[anchor=north west] {\Large $ {z}$};
\draw[color=red, rotate around={25:(0,0)}] (0,0) ellipse (2.5cm and 1.00cm);
\draw [fill] (0,0) circle (1.5pt);
\end{tikzpicture}

This code produces the plot below enter image description here

Is there any way to improve the 3D effect of the ellipse in 3D space?

2
  • Are we to presume the ellipse lies in the x-y plane, or is that not the case? Commented Apr 12, 2018 at 19:54
  • The ellipse is actually at an angle to all planes.
    – NM_
    Commented Apr 12, 2018 at 20:08

2 Answers 2

2

Here are two possibilities, depending on whether the elliptical plane is presumed to be in the x-y plane or not.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[scale=2.0, line cap=round, line join=round, >=Triangle]
\draw [->] (0,-1.75) -- (0,1.75); %z
\draw [->] (0.81,1.05) -- (-0.81,-1.05); %x
\draw [->] (-2.35,0) -- (2.35,0); %y
\draw (-1.15,-1.01) node[anchor=north west] {\Large $ {x}$};
\draw (2.40,0.15) node[anchor=north west] {\Large $ {y}$};
\draw (-0.05,2.20) node[anchor=north west] {\Large $ {z}$};
\draw[color=red, rotate around={25:(0,0)}] (0,0) ellipse (2.5cm and 1.00cm);
\draw [fill] (0,0) circle (1.5pt);
\draw [->, red] (0,0) -- (0,0.5); %z
\draw (0.05,0.70) node[anchor=north west] {\Large $ {\hat n}$};
\end{tikzpicture}

\begin{tikzpicture}[scale=2.0, line cap=round, line join=round, >=Triangle]
\draw [->] (0,-1.75) -- (0,1.75); %z
\draw [->] (0.81,1.05) -- (-0.81,-1.05); %x
\draw [->] (-2.35,0) -- (2.35,0); %y
\draw (-1.15,-1.01) node[anchor=north west] {\Large $ {x}$};
\draw (2.40,0.15) node[anchor=north west] {\Large $ {y}$};
\draw (-0.05,2.20) node[anchor=north west] {\Large $ {z}$};
\draw[color=red, rotate around={25:(0,0)}] (0,0) ellipse (2.5cm and 1.00cm);
\draw [fill] (0,0) circle (1.5pt);
\draw [->, red] (0,0) -- (-.2,0.5); %z
\draw (-0.47,0.70) node[anchor=north west] {\Large $ {\hat n}$};
\end{tikzpicture}
\end{document}

enter image description here

1

You could just use tikz-3dplot.

\documentclass[tikz,border=3.14pt]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows.meta}
\begin{document}
\tdplotsetmaincoords{70}{30}
\begin{tikzpicture}[scale=2.0, line cap=round, line join=round, >=Triangle,tdplot_main_coords]
\draw[->] (0,0,0) -- (3,0,0)node[below]{$x$};
\draw[->] (0,0,0) -- (0,3,0)node[left]{$y$};
\draw[->] (0,0,0) -- (0,0,3)node[left]{$z$};
\draw[color=red] (0,0,0) ellipse (2.5cm and 1.00cm);
\draw [fill] (0,0,0) circle (1.5pt);
\end{tikzpicture}
\end{document}

enter image description here

And then play with the viewing angles and/or draw the ellipse in a rotated plane.

EDIT: Just for fun: a rotated ellipse.

\documentclass[tikz,border=3.14pt]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows.meta}
\begin{document}
\tdplotsetmaincoords{70}{30}
\begin{tikzpicture}[scale=2.0, line cap=round, line join=round, >=Triangle,tdplot_main_coords]
\draw[->] (0,0,0) -- (3,0,0)node[below]{$x$};
\draw[->] (0,0,0) -- (0,3,0)node[left]{$y$};
\draw[->] (0,0,0) -- (0,0,3)node[left]{$z$};
\draw [fill] (0,0,0) circle (1.5pt);
\tdplotsetrotatedcoords{0}{20}{0}
\begin{scope}[tdplot_rotated_coords]
\draw[color=red] plot[variable=\x,domain=0:360,samples=360]
({2.5*cos(\x)},{sin(\x)});
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .