0

I was wondering what if I mixed the geo and heliocentric frames in one figure, I got this picture, and I want now to draw it using TikZ, I don't know how to draw the 3D figures, is there any package reserved to it ?

Here's the figure I want to be drawn, I'm sorry I didn't wrote any code simply because of my extremely low level on TikZ especially on 3d figures :

2 Answers 2

5

In case you want something less fancy, but human writeable/readable:

\begin{tikzpicture}[z={(0,1cm)},% z-axis is straight up
x={(-3.85mm,-3.85mm)},% x-axis points down to the left
y={(1cm,0)},% y-axis points straight to the right
thick,scale=2]
% axes 
\begin{scope}[->,ultra thick]
\draw(0,0,0) -- (3,0,0)node[below left]{*} node[below=10pt]{Star 3};
\draw (0,0,0) -- (0,2.5,0)node[right]{*} node[right=10pt]{Star 2};
\draw (0,0,0) -- (0,0,2)node[above]{*} node[above=10pt]{ Star 1};
\end{scope}
% label
\draw (0,1,1) node[text width=1in]{heliocentric frame};
% sun 
\draw(0,0) circle (0.5cm);
\draw(0,0,0.5) node[above left]{Sun};
% elliptical earth's orbit around sun
\draw[dashed] (0,0) ellipse (1.875cm and 0.75cm);% 2D ellipse
% earth
\begin{scope}[shift={(1.6,1.6)},% trial and error on shift 
]
\draw[->] (0,0,0) -- (1.5,0,0);
\draw[->] (0,0,0) -- (0,1,0);
\draw[->] (0,0,0) -- (0,0,1);
\draw (0,0) circle (0.25cm);
\draw (0,0,-0.35) node[below]{Earth};
\draw (0,0) ellipse (0.25cm and 0.1cm);% same ratio as earth orbit
\end{scope}
\end{tikzpicture}

which makes this

this image is the result of the Tikz code above.  It shows two sets of 3D axes, one centered at the Sun and one centered at the Earth.

Note that Tikz can do 3D coordinates, but as far as I know doesn't do 3D spheres and ellipses with it's built in commands. I forgot to add the text for "Geocentric frame" but adding it would be a good way to warm up for the new Tikz user!

1
  • I approve surely :-)
    – Sebastiano
    Jun 17, 2021 at 20:37
4

Created with Mathcha....for the newbie of TiKZ.

\documentclass[12pt]{article}
\usepackage{tikz}
\begin{document}

% Gradient Info
  
\tikzset {_uheif1z99/.code = {\pgfsetadditionalshadetransform{ \pgftransformshift{\pgfpoint{89.1 bp } { -128.7 bp }  }  \pgftransformscale{1.32 }  }}}
\pgfdeclareradialshading{_14c0b43mh}{\pgfpoint{-72bp}{104bp}}{rgb(0bp)=(0.88,0.35,0.41);
rgb(3.392857142857143bp)=(0.88,0.35,0.41);
rgb(23.125bp)=(0.91,0.92,0.15);
rgb(400bp)=(0.91,0.92,0.15)}

% Gradient Info
  
\tikzset {_kqmi50mn3/.code = {\pgfsetadditionalshadetransform{ \pgftransformshift{\pgfpoint{0 bp } { 0 bp }  }  \pgftransformrotate{0 }  \pgftransformscale{2 }  }}}
\pgfdeclarehorizontalshading{_aibr68kxs}{150bp}{rgb(0bp)=(0.72,0.88,0.99);
rgb(37.5bp)=(0.72,0.88,0.99);
rgb(40bp)=(0.66,0.82,0.95);
rgb(43.75bp)=(0.56,0.73,0.89);
rgb(46.75bp)=(0.56,0.74,0.92);
rgb(50bp)=(0.56,0.75,0.94);
rgb(50.25bp)=(0.42,0.66,0.9);
rgb(58.25bp)=(0.64,0.85,0.96);
rgb(62.5bp)=(0.74,0.95,0.99);
rgb(100bp)=(0.74,0.95,0.99)}

% Gradient Info
  
\tikzset {_l7q4mzgni/.code = {\pgfsetadditionalshadetransform{ \pgftransformshift{\pgfpoint{0 bp } { 0 bp }  }  \pgftransformscale{1 }  }}}
\pgfdeclareradialshading{_aqts5od14}{\pgfpoint{0bp}{0bp}}{rgb(0bp)=(0.93,0.89,0.51);
rgb(0.08928571428571429bp)=(0.93,0.89,0.51);
rgb(25bp)=(0.95,0.85,0.21);
rgb(400bp)=(0.95,0.85,0.21)}

% Gradient Info
  
\tikzset {_3fitct74g/.code = {\pgfsetadditionalshadetransform{ \pgftransformshift{\pgfpoint{0 bp } { 0 bp }  }  \pgftransformrotate{0 }  \pgftransformscale{2 }  }}}
\pgfdeclarehorizontalshading{_g98vur5av}{150bp}{rgb(0bp)=(0.95,0.77,0.74);
rgb(37.5bp)=(0.95,0.77,0.74);
rgb(50bp)=(0.91,0.42,0.34);
rgb(50.25bp)=(0.92,0.16,0.01);
rgb(56.25bp)=(1,0.4,0);
rgb(62.5bp)=(0.78,0.13,0);
rgb(100bp)=(0.78,0.13,0)}

% Gradient Info
  
\tikzset {_cusdwq5fb/.code = {\pgfsetadditionalshadetransform{ \pgftransformshift{\pgfpoint{0 bp } { 0 bp }  }  \pgftransformrotate{0 }  \pgftransformscale{2 }  }}}
\pgfdeclarehorizontalshading{_cf4x2w32q}{150bp}{rgb(0bp)=(0.72,0.88,0.99);
rgb(37.5bp)=(0.72,0.88,0.99);
rgb(40.535714285714285bp)=(0.66,0.82,0.95);
rgb(50.25bp)=(0.56,0.36,0.17);
rgb(60.12416294642857bp)=(0.64,0.85,0.96);
rgb(62.5bp)=(0.74,0.95,0.99);
rgb(100bp)=(0.74,0.95,0.99)}
\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt        

\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,464); %set diagram left start at 0, and has height of 464

%Shape: Axis 2D [id:dp812091251605362] 
\draw [line width=1.5]  (294.92,319.37) -- (342,319.37)(299.63,277) -- (299.63,324.08) (335,314.37) -- (342,319.37) -- (335,324.37) (294.63,284) -- (299.63,277) -- (304.63,284)  ;
%Straight Lines [id:da23673456966432171] 
\draw [line width=1.5]    (299.63,319.37) -- (277.12,341.88) ;
\draw [shift={(275,344)}, rotate = 315] [color={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=1.5]    (14.21,-6.37) .. controls (9.04,-2.99) and (4.3,-0.87) .. (0,0) .. controls (4.3,0.87) and (9.04,2.99) .. (14.21,6.37)   ;

%Shape: Axis 2D [id:dp05090589551403468] 
\draw [color={rgb, 255:red, 184; green, 233; blue, 134 }  ,draw opacity=1 ][line width=1.5]  (189,268.5) -- (404,268.5)(210.5,75) -- (210.5,290) (397,263.5) -- (404,268.5) -- (397,273.5) (205.5,82) -- (210.5,75) -- (215.5,82)  ;
%Straight Lines [id:da3138825477839955] 
\draw [color={rgb, 255:red, 184; green, 233; blue, 134 }  ,draw opacity=1 ][line width=1.5]    (210.5,268.5) -- (100.12,378.88) ;
\draw [shift={(98,381)}, rotate = 315] [color={rgb, 255:red, 184; green, 233; blue, 134 }  ,draw opacity=1 ][line width=1.5]    (14.21,-6.37) .. controls (9.04,-2.99) and (4.3,-0.87) .. (0,0) .. controls (4.3,0.87) and (9.04,2.99) .. (14.21,6.37)   ;

%Shape: Ellipse [id:dp6358119726686489] 
\draw  [dash pattern={on 0.84pt off 2.51pt}] (31.73,268.5) .. controls (31.73,237.23) and (111.77,211.88) .. (210.5,211.88) .. controls (309.23,211.88) and (389.27,237.23) .. (389.27,268.5) .. controls (389.27,299.77) and (309.23,325.13) .. (210.5,325.13) .. controls (111.77,325.13) and (31.73,299.77) .. (31.73,268.5) -- cycle ;
%Shape: Circle [id:dp6603692222286022] 
\draw  [draw opacity=0][shading=_14c0b43mh,_uheif1z99] (185.5,268.5) .. controls (185.5,254.69) and (196.69,243.5) .. (210.5,243.5) .. controls (224.31,243.5) and (235.5,254.69) .. (235.5,268.5) .. controls (235.5,282.31) and (224.31,293.5) .. (210.5,293.5) .. controls (196.69,293.5) and (185.5,282.31) .. (185.5,268.5) -- cycle ;
%Shape: Star [id:dp3210625600697121] 
\path  [shading=_aibr68kxs,_kqmi50mn3] (423,249) -- (426.53,263.15) -- (441.07,262.13) -- (428.71,269.85) -- (434.17,283.37) -- (423,274) -- (411.83,283.37) -- (417.29,269.85) -- (404.93,262.13) -- (419.47,263.15) -- cycle ; % for fading 
 \draw  [color={rgb, 255:red, 255; green, 255; blue, 255 }  ,draw opacity=1 ] (423,249) -- (426.53,263.15) -- (441.07,262.13) -- (428.71,269.85) -- (434.17,283.37) -- (423,274) -- (411.83,283.37) -- (417.29,269.85) -- (404.93,262.13) -- (419.47,263.15) -- cycle ; % for border 

%Shape: Star [id:dp30385001322189864] 
\path  [shading=_aqts5od14,_l7q4mzgni] (91.47,369.85) -- (95,384) -- (109.54,382.98) -- (97.18,390.71) -- (102.64,404.23) -- (91.47,394.85) -- (80.31,404.23) -- (85.77,390.71) -- (73.4,382.98) -- (87.95,384) -- cycle ; % for fading 
 \draw  [color={rgb, 255:red, 255; green, 255; blue, 255 }  ,draw opacity=1 ] (91.47,369.85) -- (95,384) -- (109.54,382.98) -- (97.18,390.71) -- (102.64,404.23) -- (91.47,394.85) -- (80.31,404.23) -- (85.77,390.71) -- (73.4,382.98) -- (87.95,384) -- cycle ; % for border 

%Shape: Star [id:dp7745183315132196] 
\path  [shading=_g98vur5av,_3fitct74g] (210,43) -- (214.11,56.34) -- (228.07,56.13) -- (216.66,64.16) -- (221.17,77.37) -- (210,69) -- (198.83,77.37) -- (203.34,64.16) -- (191.93,56.13) -- (205.89,56.34) -- cycle ; % for fading 
 \draw  [color={rgb, 255:red, 255; green, 255; blue, 255 }  ,draw opacity=1 ] (210,43) -- (214.11,56.34) -- (228.07,56.13) -- (216.66,64.16) -- (221.17,77.37) -- (210,69) -- (198.83,77.37) -- (203.34,64.16) -- (191.93,56.13) -- (205.89,56.34) -- cycle ; % for border 

%Shape: Circle [id:dp4466353465802877] 
\draw  [draw opacity=0][shading=_cf4x2w32q,_cusdwq5fb] (289,317.25) .. controls (289,311.31) and (293.81,306.5) .. (299.75,306.5) .. controls (305.69,306.5) and (310.5,311.31) .. (310.5,317.25) .. controls (310.5,323.19) and (305.69,328) .. (299.75,328) .. controls (293.81,328) and (289,323.19) .. (289,317.25) -- cycle ;

% Text Node
\draw (156,236) node [anchor=north west][inner sep=0.75pt]  [font=\large] [align=left] {\textit{Sun}};
% Text Node
\draw (301.75,331) node [anchor=north west][inner sep=0.75pt]  [font=\large] [align=left] {Geocentric\\frame};
% Text Node
\draw (245,291) node [anchor=north west][inner sep=0.75pt]  [font=\large] [align=left] {\textit{Earth}};
% Text Node
\draw (400,230) node [anchor=north west][inner sep=0.75pt]  [font=\large] [align=left] {Star 2};
% Text Node
\draw (187,22) node [anchor=north west][inner sep=0.75pt]  [font=\large] [align=left] {Star 1};
% Text Node
\draw (60,405) node [anchor=north west][inner sep=0.75pt]  [font=\large] [align=left] {Star 3};
% Text Node
\draw (251.75,152) node [anchor=north west][inner sep=0.75pt]  [font=\large] [align=left] {Heliocentric frame};


\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 .