# Drawing 2D shapes using 3D coordinates with tikz

I tried to draw planetary system consisting of Sun-Venus-Earth. My code is

\begin{tikzpicture}[scale=0.1]
%-> DEFINITIONS
%... sizes
\def\eorb{60}
\def\vorb{0.7*\eorb}

\begin{scope}[canvas is zx plane at y=0]
\draw[very thick]
node{Sun}
;
\draw[->, thick, dotted]
(50:\vorb)
node[below]{Venus}
arc(50:120:\vorb)
;
\draw[->, thick, dotted]
(50:\eorb)
node[below]{Earth}
arc(50:120:\eorb)
;
\end{scope}
\end{tikzpicture}


Question: How to draw the circles on zx plane without being deformed, but keeping the arc exactly as the already are?

Of course. You only have to define the coordinates of the centers of these objects inside the canvas is zx plane at y=0 scope, and draw the circles around these centers outside.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{3d}
% fix wrong implementation of xy canvas https://tex.stackexchange.com/a/48776/121799
\makeatletter
\tikzoption{canvas is xy plane at z}[]{%
\def\tikz@plane@origin{\pgfpointxyz{0}{0}{#1}}%
\def\tikz@plane@x{\pgfpointxyz{1}{0}{#1}}%
\def\tikz@plane@y{\pgfpointxyz{0}{1}{#1}}%
\tikz@canvas@is@plane
}
\makeatother
\begin{document}
\begin{tikzpicture}[scale=0.1]
%-> DEFINITIONS
%... sizes
\def\eorb{60}
\def\vorb{0.7*\eorb}

\begin{scope}[canvas is zx plane at y=0]
\path
(0,0) coordinate (Sun)
(60:\vorb) coordinate (Venus)
(60:\eorb) coordinate (Earth)
;
\draw[->, thick, dotted]
(50:\vorb)
node[below]{Venus}
arc(50:120:\vorb)
;
\draw[->, thick, dotted]
(50:\eorb)
node[below]{Earth}
arc(50:120:\eorb)
;
\end{scope}
\draw[very thick]
\end{tikzpicture}
\end{document}


If you also want to change the view, I'd recommend loading tikz-3dplot.

• Thank you, @marmot (allways you and I am becoming a fan)! I used the code and it works perfectly even without the \makeatletter arguments. Should I care with it? Nov 13 '18 at 17:49
• @Brasil Not for this MWE, but I started distributing the fix for the xy plane to make it less likely for others to get unnecessary headache. You are, at this point, only using the xy plane, so you do not need it. However, as soon as you add stuff in which you need the xy plane, you'll need it.
– user121799
Nov 13 '18 at 17:53
• Good! I just asked because I separate the files for figures from my work file so that I can use the figure elsewhere. So, my new doubt: \makeatletter must be at the preamble, or can be at any other place (the tex file with the tizkpicture, for instance)? Nov 13 '18 at 17:55
• In this case I believe you can put it everywhere as this is just a (re)definition of a tikzoption. And as I said for the example you can drop it.
– user121799
Nov 13 '18 at 17:59
• For the record: Jake's patch is now incorporated in v3.1 of TikZ. Jan 15 '19 at 19:29