7

I am beginner and I'd like to know if it is possible to recreate this image in Latex.

XYZ Coordinate System

I've tried to find some examples to help me, but I didn't succeed.

Thanks in advance

5
  • 4
    Welcome! What do you have so far? In what sense is that an email? The TikZ manual has good tutorials at the beginning. You should be able to draw a good chunk of it from that.
    – cfr
    Jul 19, 2017 at 15:47
  • 1
    Check out tex.stackexchange.com/questions/63370/… Jul 19, 2017 at 15:50
  • @cfr I am trying to draw at least the coordinate system. I'll check the TikZ manual. Thanks! Jul 19, 2017 at 17:58
  • @JohnKormylo thanks! That's almost what I need, I'll work on that as well. Jul 19, 2017 at 18:00
  • tikz-3dplot might also be useful, but probably overkill for this. (Will probably just complicate things.)
    – cfr
    Jul 19, 2017 at 18:55

2 Answers 2

9

after some hours and following your tips I've arrived at a acceptable solution.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows} 
\begin{document}
    \begin{figure}
        \begin{tikzpicture}
            [axis/.style={thin, black, ->, >=stealth'}]

            %AXIS
            \draw[axis] (0,0) -- (0,2) node [above, black] {\scriptsize +Z};
            \draw[axis] (0,0) -- (0,-2) node [below, black] {\scriptsize -Z};
            \draw[axis] (0,0) -- (-20:2) node [right, black] {\scriptsize +X};
            \draw[axis] (0,0) -- (160:2) node [left, black] {\scriptsize -X};
            \draw[axis] (0,0) -- (20:2) node [right, black] {\scriptsize +Y};
            \draw[axis] (0,0) -- (200:2) node [left, black] {\scriptsize -Y};

            %CILINDER
            \draw [thick](0,0.6) ellipse (0.3 and 0.1);
            \draw [thick](-0.3,0.6) -- (-0.3,0);
            \draw [thick](-0.3,0) arc (180:360:0.3 and 0.1);
            \draw [thick](0.3,0.6) -- (0.3,0);  
            \fill [lightgray,opacity=1] (-0.3,0.6) -- (-0.3,0) arc (180:360:0.3 and 0.1) -- (0.3,0.6) arc (0:180:0.3 and -0.1);
            \fill [white, opacity=1] (-0.26,0.6) arc (180:360:0.26 and 0.085) -- (-0.26,0.6);

           %ROTATIONS           
           \draw [thick, <->, >=stealth'] (0.1,1) arc (-80:260:15pt and 5pt) node [right=14pt, black] {\scriptsize C};
           \draw [thick, <->, >=stealth'] (1,-0.45) arc (-170:170:5pt and 15pt) node [right=16pt, above=0pt, black] {\scriptsize A};
           \draw [thick, <->, >=stealth'] (-1,-0.3) arc (10:350:5pt and 15pt) node [left=17pt, above=4pt, black] {\scriptsize B};

        \end{tikzpicture}
    \end{figure}
\end{document}

Result:

XYZ Coordinate System

3
  • 1
    Good job ! If I remember, maybe I'll showcase the interest in using tikz-3dplot tomorrow. You still forgot to explain the email part, though !
    – marsupilam
    Jul 19, 2017 at 21:20
  • @marsupilam I just revised my initial message, the word "email" was not supposed to be there rs I'll correct it. Thanks! Jul 19, 2017 at 22:42
  • Nice work! Thanks for clearing up the email mystery. I was quite puzzled by that. ;)
    – cfr
    Jul 20, 2017 at 2:46
4

Using the tikz-3dplot package and the undocumented 3d tikz library.

The output

enter image description here

The code

\documentclass[12pt,tikz]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows,3d}
\begin{document}

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

\tdplotsetmaincoords{\angThe}{\angPhi}
\begin{tikzpicture}[tdplot_main_coords, >=stealth',scale=4]

  \begin{scope}[<->] %% axis lines
    \def\l{1}
    \draw (-\l,0) -- (1.5*\l,0) node [pos=1.05] {$x$};
    \draw (0,-\l) -- (0,\l)     node [pos=1.05] {$y$};
    \draw (0,0,-.6) -- (0,0,\l) node [pos=1.05] {$z$};
  \end{scope}

  \def\r{.3} % radius of cylinder
  \def\z{.6} % height of cylinder
  \draw [fill=blue!20](0,0,\z) circle (\r) ; % top disk of cylinder

  %% vertical facet of the cylinder  %------------------------------------%
  \pgfmathsetmacro{\angPhiOpp}{\angPhi-180}

  \draw [fill=blue!10] (\angPhi:\r) arc (\angPhi:\angPhiOpp:\r) 
  {[shift={(0,0,\z)}]
                    -- (\angPhiOpp:\r) arc (\angPhiOpp:\angPhi:\r) 
  } -- cycle;

  % whoops, need to redraw this !
  \draw [shift={(0,0,\z)}](0,0) -- (\angPhi+90:\r) ;

  %% circular arrows %----------------------------------------------------%

  \def\rr{.2} % radius for the circular arrows arrows
  \begin{scope}[canvas is xy plane at z=-.3]
    \def\angS{50}
    \def\angE{370}
    \draw [<->](\angS:\rr) arc (\angS:\angE:\rr) ;
  \end{scope}
  \begin{scope}[canvas is yz plane at x=.9]
    \def\angS{100}
    \def\angE{420}
    \draw [<->](\angS:\rr) arc (\angS:\angE:\rr) ;
  \end{scope}
  \begin{scope}[canvas is zx plane at y=.6]
    \def\angS{100}
    \def\angE{420}
    \draw [<->](\angS:\rr) arc (\angS:\angE:\rr) ;
  \end{scope}

\end{tikzpicture}
\end{document}

You must log in to answer this question.

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