# Optimizing perspective tikz graphic

I could use a little help optimizing the following tikz graphic:

\documentclass[border=3pt]{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
\filldraw[black!5] (-4.5,-1.5)--(1.5,-1.5)--(4.5,1.5)--(-1.5,1.5)--(-4.5,-1.5);
\draw[->] (-1.5,-1.5)--(1.5,1.5);
\draw[->] (-3,0)--(3,0);
\node[right] at (3,0) {$x$};
\node[above] at (1.5,1.5) {$y$};
\def\firstellipse{(0,0) ellipse (2.5 and .7)};
\draw[cyan!80]\firstellipse;
\def\secondellipse{(0,0) ellipse (1.5 and .4)};
\draw[orange]\secondellipse;
\node[circle,inner sep=.5pt,draw=red] at (2,.41) {};
\node[above] at (2.1,.41) {$\color{red}P$};
\node[circle,inner sep=.5pt,draw=red] at (1,.-.298) {};
\node[below] at (1.1,-.3) {$\color{red}Q$};
\end{tikzpicture}

\end{document}


1. I would like some dotted arrows along the ellipses starting at P and Q. Maybe 1cm long. Do I have to figure out the correct arc configurations by trying?
2. As you can see, I've drawn the x- and y-axis, as well as the (supposed to be) circles by estimating. Is there a proper way of drawing circles in a plane without tikz-3D? Or do you think it suffices to do it this way?
3. Any other recommendations as to optimize this graphic? Maybe in terms of color or other details. It's basically about the orbits of points in the euclidean plane $\mathbb R^2$ when acting with the special orthogonal group $SO(2)$. It's supposed to be associated with the planetal orbits.
• You don't want to use tikz-3dplot ? Any particular reason ? – marsupilam Aug 28 '17 at 12:24
• I'd have to get familiar with this package first which I assume is quite time consuming. However, if you can generate a nice graphic using tikz-3dplot, feel free to show me! I'd love to see one and if it's not too complicated for me to reproduce I might use it. – user424862 Aug 28 '17 at 12:27

Just showcasing tikz-3dplot.

So this is essentially what you have drawn.

\documentclass[tikz,border=3pt]{standalone}
\usepackage{tikz-3dplot}

\begin{document}

%% viewing angles %%
\def\angThe{70}
\def\angPhi{55}

\tdplotsetmaincoords{\angThe}{\angPhi}
\begin{tikzpicture}%[tdplot_main_coords,scale=1.5]
\filldraw[black!5] (-3,-3) -- (-3,3) -- (3,3) -- (3,-3) -- cycle;
\draw[->] (-3,0)--(3,0) node [at end, above] {$x$};
\draw[->] (0,-3)--(0,3) node [at end, right] {$y$};
\def\r{1.5} % smaller one
\draw[cyan!80] (0,0) circle (\R);
\draw[orange] (0,0) circle (\r);
\node [circle,inner sep=.5pt,draw=red,label={[red,above right]$P$}] at (25:\R) {};
\node [circle,inner sep=.5pt,draw=red,label={[red,below right]$Q$}] at (-25:\r) {};
\end{tikzpicture}

\end{document}


It produces :

We uncomment the options [tdplot_main_coords,scale=1.5] of the tikzpicture.

Everything transforms like so :

Now we have a nice setup : we work the hard stuff in the plane (with tikz-3dplot commented) and once in a while, we check back in 3d how things look.

In particular the ellipse arrows you want to draw are simply arcs (probably much easier to work with.)

With a bit a fiddling around, we can get this :

\documentclass[tikz,border=3pt]{standalone}
\usepackage{tikz-3dplot}

\begin{document}

%% viewing angles %%
\def\angThe{70}
\def\angPhi{55}

\tdplotsetmaincoords{\angThe}{\angPhi}
\begin{tikzpicture}[tdplot_main_coords,scale=1.5]
\filldraw[black!5] (-3,-3) -- (-3,3) -- (3,3) -- (3,-3) -- cycle;
\draw[->] (-3,0)--(3,0) node [at end, above right] {$x$};
\draw[->] (0,-3)--(0,3) node [at end, below right] {$y$};
\def\R{2.5}
\def\r{1.5}
\draw[cyan!80] (0,0) circle (\R);
\draw[orange] (0,0) circle (\r);
\node [circle,inner sep=.5pt,draw=red,label={[red,below right]$P$}] (P) at (25:\R) {};
\node [circle,inner sep=.5pt,draw=red,label={[red,above]$Q$}] at (-25:\r) {};
\draw [->, thick, red](25:\R-.1) arc [start angle=25,end angle=55,radius=\R-.1] ;
\draw [->, thick, red](-25:\r+.1) arc [start angle=-25,end angle=05,radius=\r+.1] ;
\end{tikzpicture}

\end{document}


Otherwise, without using tikz-3dplot at all, we set the y unit vector by hand.

\documentclass[tikz,border=3pt]{standalone}
\begin{document}

\begin{tikzpicture}[y={(.5cm,.7cm)}]
\filldraw[black!5] (-3,-3) -- (-3,3) -- (3,3) -- (3,-3) -- cycle;
\draw[->] (-3,0)--(3,0) node [at end, above right] {$x$};
\draw[->] (0,-3)--(0,3) node [at end, below right] {$y$};
\def\R{2.5}
\def\r{1.5}
\draw[cyan!80] (0,0) circle (\R);
\draw[orange] (0,0) circle (\r);
\node [circle,inner sep=.5pt,draw=red,label={[red,below right]$P$}] (P) at (25:\R) {};
\node [circle,inner sep=.5pt,draw=red,label={[red,above]$Q$}] at (-25:\r) {};
\draw [->, thick, red](25:\R-.1) arc [start angle=25,end angle=55,radius=\R-.1] ;
\draw [->, thick, red](-25:\r+.1) arc [start angle=-25,end angle=05,radius=\r+.1] ;
\end{tikzpicture}

\end{document}

• Wow, these really look amazing. Unfortunately, I can't complie your code for the first one as I get an "undefined control sequence" error referring to \tdplotsetmaincoords{\angThe}{\angPhi}. What might that be? I simply copy and pasted your code. Edit: I should note that at first I'm trying to get the 2D version without the '[tdplot_main_coords,scale=1.5]'. – user424862 Aug 28 '17 at 13:15
• @user424862 sounds like you don't have tikz-3dplot installed, as \tdplotsetmaincoords is defined by the package. – marsupilam Aug 28 '17 at 13:18
• I double-checked. It's definitely installed, but now I'm getting the error "tikz-3dplot.sty not found". Maybe I installed an incomplete package? – user424862 Aug 28 '17 at 13:21
• Just copy the file tikz-3dplot.sty in your working directory. Should work... – marsupilam Aug 28 '17 at 13:27
• Yeah, that was it. Strange! But anyway, thanks a lot for your help, really appreciate it! – user424862 Aug 28 '17 at 13:32