# how to use tikz plot coordinate axes and arrows？

A planner figure, any visual tools can help?

• Well, general relativity is even harder for beginners, but this does not mean that others will do your computations for you. Likewise, if you have difficulties with drawing your picture, this does not mean that others take over. For newcomers we sometimes make exceptions, but after the first answer you have already an idea what an MWE is. So please show us what you've tried. – user121799 Dec 15 '18 at 2:46
• @marmot i will try after class, thank you. if anyone have answer, comment after i have tried. – Ben Dec 15 '18 at 3:40
• Next time please don't upload images that are not upright. Seeing those is much harder than doing others. – Money Oriented Programmer Dec 15 '18 at 6:25
• @ArtificialStupidity i see, it’s not upright, I will correct. thank you! – Ben Dec 15 '18 at 7:40

with use of tikz librariesangles (for drawing angles), \arrows.meta (for nice arrows), calc (for drawing orthogonal vectors) and quotes (for angle labels), and use polar coordinates the code for your image can be as follows:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{angles, arrows.meta, calc, quotes}

\begin{document}
\begin{tikzpicture}[% styles used in image code
> = Straight Barb, % defined in "arrows.meta
dot/.style = {circle, fill,
minimum size=2mm, inner sep=0pt, outer sep=0pt,
node contents={}},
box/.style = {draw, thin, minimum  width=2mm, minimum height=4mm,
inner sep=0pt, outer sep=0pt,
node contents={}, sloped},
my angle/.style args = {#1/#2}{draw,->,
angle eccentricity=#2,
} % angle label position!
]
% coordinate axis
\draw[->] (-3,0) -- (6,0) node[below left] {$x$};
\draw[->] ( 0,0) coordinate[label=below:$O$] (O)
-- (0,6) node[below left] {$y$};
% axis units
\draw[->,thick] (0,0) -- (1,0) node[below] {$i$};
\draw[->,thick] (0,0) -- (0,1) node[right] {$j$};
% dashed line
\draw[dashed]  (-2,0) coordinate (s)
-- ++ (32:4.2) node (d1) [dot];
% angle theta, used "angles" and "quotes" library
\pic [draw, my angle=12mm/0.8, "$\Theta$"] {angle = O--s--d1};
% solid line
\draw[thick]    (d1)  -- node (m) [box] ++ (32:3) node (d2) [dot];
% angle N_z
\pic [draw, my angle=6mm/1.5, "$Nz$"] {angle = d2--m--d1};
% forces in y and x direction
\draw[->] (m.center) -- ++ (1,0) node[below] {$F_xi$};
\draw[->] (m.center) -- ++ (0,2) node[left] {$F_xj$};
% vectors v_1, v, v_2, used "calc" library
\draw[->] (d1) -- ($(d1)!12mm! 90:(d2)$);
\draw[->] (d1) -- ($(d1)!12mm!270:(d2)$) coordinate[label=below right:$v_1$] (v1);
\draw[->] (m.center) -- ($(m.center)!12mm!270:(d2)$) coordinate[label=below right:$v$] (v);
\draw[->] (d2) -- ($(d2)!12mm!270:(d1)$);
\draw[->] (d2) -- ($(d2)!12mm! 90:(d1)$) coordinate[label=below right:$v_2$] (v2);
% dashed line between vectors v_1, v_2
\draw [dashed] (v1)--(v2);
\end{tikzpicture}
\end{document}

• In the image attached to the question, v1, v and v2 are not of the same length. – AndréC Dec 16 '18 at 4:29

Yeah, it is not difficult. when you meet problems, do not afraid, just do it step by step.

Although my method based on translation and rotation,\draw everything, not smart, the code is very redundant.

There is the first version. I will keep learning. next, I will use \coordinate to make code simple and efficient.

code as follows:

\documentclass[letter]{article}
\usepackage{tikz}
\begin{document}
\centering
\begin{tikzpicture}
\draw[->] (-2.4,0)--(5,0) node[below] {$x$}; %coordinate
\draw[->] (0,0)--(0,6) node[left] {$y$};

\draw[->,thick] (0,0)--(1,0) node[near start,below] {$O$} node[below] {$i$}; %unit coordinate
\draw[->,thick] (0,0)--(0,1) node[left] {$j$};

\draw [dashed,xshift=-2cm,rotate=32]  (0,0)--(4.2,0); %line
\draw [xshift=-2cm,rotate=32]  (4.2,0)--(7.2,0);
\draw[->] (-0.8cm,0) arc (0:32:1.2cm) node[left=1.2pt,below=2.1pt] {$\Theta$}; %arc 1

\filldraw[fill=black,xshift=-2cm,rotate=32] (4.2,0) circle (0.1cm); % M1
\draw[->,xshift=-2cm,rotate=32] (4.2,0)--(4.2,1.1);
\draw[->,xshift=-2cm,rotate=32] (4.2,0)--(4.2,-1.45) node[name=v1,right=1pt,below=1pt] {$v_1$};

%rectangle (5.7)
\draw [xshift=-2cm,rotate=32] (5.6,-0.2) rectangle (5.8,0.2);
\draw[->,xshift=-2cm,rotate=32] (6.0cm,0) arc (0:180:0.3cm) node[left=3pt,above=10pt] {$N_z$}; %arc 2
\draw[->,xshift=-2cm,rotate=32] (5.7,0)--(5.7,-1.4) node[right=1pt,below=1pt] {$v$}; %v

\filldraw[fill=black,xshift=-2cm,rotate=32] (7.2,0) circle (0.1cm); % M2
\draw[->,xshift=-2cm,rotate=32] (7.2,0)--(7.2,1);
\draw[->,xshift=-2cm,rotate=32] (7.2,0)--(7.2,-1.3) node[name =v2,right=1pt,below=1pt] {$v_2$};

\draw[->,xshift=-2cm,rotate=32] (5.7,0)--(5.7,0) node[name =c1] {};
\draw[->,xshift=-2cm,rotate=32,rotate around={-32:(c1)}] (5.7,0)--(6.7,0) node[below] {$F_xi$};
\draw[->,xshift=-2cm,rotate=32,rotate around={-32:(c1)}] (5.7,0)--(5.7,2) node[left] {$F_xj$};
\draw [dashed,xshift=-2cm,rotate=32] (4.2,-1.45)--(7.2,-1.3);
\end{tikzpicture}
\end{document}

Reference: http://texdoc.net: pgf manual.

• Please don't link to that manual, version 3 of TikZ is around five years old already. Link to CTAN (or texdoc.net) instead. – Torbjørn T. Dec 15 '18 at 16:05
• (i) please, always provide complete small document, not only code fragment (ii) with your code (after adding extend it to mwe) i can't reproduce image showed in your answer. – Zarko Dec 16 '18 at 1:16
• @Zarko already improved, thank you, let me know if you have any questions about it. – Ben Dec 16 '18 at 1:48
• i saw your corrections :-). now works. well, meantime i write my suggestion how to draw your image. see if it can be helpful :-) – Zarko Dec 16 '18 at 2:19
• @Zarko thank you, it is very helpful :-). I spent much time drawing orthogonal vectors $F_xi$. your answer is simple than me, especially in readability of the code. I have an irrelevant question, how do you think about the Asymptote, I saw the document in the official site, is it more convenient in drawing 3d graphics? – Ben Dec 16 '18 at 2:33