[Tex/LaTex] How to Draw This Free Body Diagram on TikZ or PGFPlots

pgfplotstikz-pgf

enter image description hereThis is not a duplicate question of the one titled Creating a Free Body Diagram in TikZ. I am confused as to how one might draw this specific diagram:

Say we want to describe two masses on a pulley and we want to draw 2 diagrams, 1 for each box. They would look like this:

(down arrow) m1g

string

mass 1 (circle)

(up arrow) T

and:

(down arrow) m2g

string

mass 2 (circle)

(up arrow) T

Here is what I've got so far:

\documentclass[11pt]{article}

\usepackage{tikz}

\usepackage[pdftex]{graphicx}

\usetikzlibrary{quotes}

\begin{document}
\begin{tikzpicture}
\path [draw] (0,2) -- (0,1);
\path (0,2)
    edge [near start, xshift=5pt, "$T$", <-, shorten >=10pt, shorten <=2.5pt] (0,1);
\path (0,1)
    edge [very near end, xshift=5pt, "$m_1g$", ->, shorten <=10pt, shorten >=2.5pt] (0,0);
  \node [circle, fill, radius=2.5pt, label=right:$mass_1$] at (0,1) {};
  \end{tikzpicture}

  \end{tikzpicture}
\end{document}

Best Answer

\documentclass[11pt]{article}

\usepackage{tikz}

\begin{document}
  \begin{tikzpicture}
     \begin{scope}
      \draw[<-] (0,0) -- node[right]{$W_{m}$}(0,2)
                node[circle,fill,inner sep=3mm,text=white,anchor=south] (m) {$m$};
      \draw (m.north) -- node[right]{$T \uparrow$} +(0,2);
     \end{scope}
     \begin{scope}[shift={(2cm,-8mm)}]
      \draw[<-] (0,0) -- node[right]{$W_{2m}$}(0,2)
                node[circle,fill,inner sep=6mm,text=white,anchor=south] (m) {$m$};
      \draw (m.north) -- node[right]{$T \uparrow$} +(0,2);
     \end{scope}
  \end{tikzpicture}
\end{document}

enter image description here

Explanations:

scope forms a group around its contents so that we can perform operations (like shift) on the entire group. Every node's contents are separated from the border by inner sep (In other words, the distance between the contents and the border). By adjusting inner sep we can make the node bigger or smaller (so as to just enclose the contents). We can label a node by (m) so that we can use that node's anchors (for ex, m.north) later whereas {m} is the content of the node. And finally (m.north) -- +(0,2) means draw a line fron m.north to a point that is 0cm away horizontally and 2cm away vertically.