\documentclass[tikz]{standalone}

\usepackage{tensorstyle}

\begin{document}

\newcommand\drawSpin[2]{
    \pgfmathsetmacro\spinLength{0.8}
    \draw[fill] #1 circle (0.1);
    \draw[thick,->, rotate around={#2:#1},shift={(0,-0.5*\spinLength)}] #1 -- ++(0,\spinLength);
}
    

\begin{tikzpicture}[x=\unitCm cm,y=\unitCm cm, scale=\scale, transform shape]
    \begin{scope}[shift={(0,0)}]
        \pgfmathsetmacro{\xlen}{0.3}
        \draw[->] (0,0) -- (\xlen,\xlen) node[anchor=south west] {$x$};
        \draw[->] (0,0) -- (0,2*\xlen) node[anchor=south] {$z$};
        \draw[->] (0,0) -- (2*\xlen,0) node[anchor=west] {$y$};
    \end{scope}

    \begin{scope}[shift={(1.5,0.3)}]
        \edef\BColor{fg2}
        \pgfmathsetmacro\BLength{1.5}
        \pgfmathsetmacro\Bdistance{0.25}
        \pgfmathsetmacro\N{8} % N spins
        \pgfmathsetmacro\NB{2*\N-2} % B idx
        \foreach \i in {0,...,\NB} {
            \node (B\i) at (\Bdistance*\i,0) {};
            \draw[->,draw=\BColor,rotate around={-45:(B\i)}] ($(B\i)+(0,-0.5*\BLength)$) -- ++(0,\BLength);
        }
        \node[color=\BColor] at (\N/4-3/4,-0.8) {$\vec{B}$};
        % spins
        \draw[thick] (0,0) -- (3.5,0);
        \drawSpin{(0,0)}{0}
        \drawSpin{(0.5,0)}{-5}
        \drawSpin{(1.0,0)}{10}
        \drawSpin{(1.5,0)}{0}
        \drawSpin{(2.0,0)}{-24}
        \drawSpin{(2.5,0)}{-13}
        \drawSpin{(3.0,0)}{8}
        \drawSpin{(3.5,0)}{3}
    \end{scope}

    
\end{tikzpicture}

\end{document}

