TikZ:用虚线部分椭圆箭头装饰圆圈

TikZ:用虚线部分椭圆箭头装饰圆圈

我正在尝试重现这个简单的绘图,如何模拟虚线椭圆来模拟粒子的旋转?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{
 tikz
}


\begin{document}

\begin{figure}
    \centering
    \begin{tikzpicture}
        \draw [stealth-](0,0) -- (0,-3) node [midway, left] {$B_0$};
        \draw [stealth-](1.5,-.5) -- (1.5,-1.5);
        \draw[fill=none](1.5,-2) circle (.5);
    \end{tikzpicture}
\end{figure}

\end{document}

在此处输入图片描述

答案1

以下是一种方法:

结果

使用弧线有点棘手:

  • 想想看,你是一个阴谋家
  • 首先将笔移到起始位置\draw (5.4,-1.9)
  • 接下来逆时针画一个圆弧arc [start angle=25,end angle=-220,x radius=10mm,y radius =2mm];,即使用负角
  • 最后引入你想要的格式\draw[dashed,->]
  • 选择参数需要一点反复试验......
\documentclass[10pt,border=3mm,tikz]{standalone}
%\documentclass{article}
%\usepackage[utf8]{inputenc}
%\usepackage[english]{babel}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}% <<< new


\begin{document}

%\begin{figure}
%    \centering
    \begin{tikzpicture}[
        >={Stealth}    % redefining all arrow tips
    ]
        % ~~~ posted code ~~~~~~~~~~~~~~~~
        \draw [stealth-](0,0) -- (0,-3) node [midway, left] {$B_0$};
        \draw [stealth-](1.5,-.5) -- (1.5,-1.5);
        \draw[fill=none](1.5,-2) circle (.5);
        
        % ~~~ new code ~~~~~~~~~~~~~~~~~~~~~~
        \draw [->](3,-3) -- (3,0) node [midway, left] {$\vec{B_0}$};
        \draw[->] (4.5,-1.5) -- (4.5,-0.5);
        \draw (4.5,-2)  circle (.5) ;
        % ... and now the arc ..................
        \draw[dashed,->] (5.4,-1.9) arc [start angle=25,
                            end angle=-220, 
                            x radius=10mm,
                            y radius =2mm];
    \end{tikzpicture}
%\end{figure}

\end{document}

答案2

通过使用positioning图像元素放置库和圆形节点:

\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                positioning}% <--- new


\begin{document}
    \begin{tikzpicture}[> = {Stealth}]
\draw[->] (0,-1.5) -- node (b) [midway, left] {$\vec{B_0}$} (0,1.5);
\node (c) [circle, draw, inner sep=0pt, minimum size = 6mm, right=of b] {};
\draw[->] (c.north) -- ++ (0,12mm);
%
\draw[densely dashed, ultra thin, ->] (c.center) ++ (15:4mm) arc (60:-240: 8mm and 1mm);
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容