箭头未对齐

箭头未对齐

我正在尝试在 tikz 中创建一个多连接区域。圆圈内部的箭头以某种方式奇怪地倾斜或成角度。如放大的图片所示。我给它们上了颜色,以便于查看。在此处输入图片描述

在此处输入图片描述

这就是我想要实现的目标(类似于此)。

在此处输入图片描述

看看圆圈上的箭头,它们对齐得很好。如何让它看起来像那样。谢谢。这是代码

    \documentclass[border=3mm,tikz]{standalone}
    \usetikzlibrary{decorations.markings,decorations.pathmorphing}
    \usetikzlibrary{hobby}
    \begin{document}

    \begin{tikzpicture}[decoration={
    markings,% switch on markings
    mark=at position .75 with {\arrow[line width=.02mm]{stealth}},
    }
    ]
    \path[gray!40, fill=gray!20,draw,use Hobby shortcut,closed=true,scale=.75]
                          (0,1) .. (1,3) .. (3,3) .. (4,2) .. (4.5,.5) .. (4,0) .. (3,.2) .. (1,0);
    \draw[postaction={decorate},fill=white] (1,1.2) circle (.2cm);
    \draw[postaction={decorate},fill=white] (2,1.2) circle (.2cm);
    \end{tikzpicture}

    \end{document}

新守则

    \begin{tikzpicture}[bullet/.style={circle,fill,inner sep=0.6pt,outer sep=0pt},node font=\tiny,
        every label/.append style={inner sep=0pt}]
    \path[gray!40, fill=gray!20,draw,use Hobby shortcut,closed=true]
                          (0,1.5) .. (1.5,3) .. (3,3) .. (5,2) .. (4.5,.5) .. (4,0) .. (3.2,.2) .. (1,0);
    \draw[postaction={draw,-{stealth[bend,length=1mm]}},fill=white] (.5,1.5) + (-90:0.2)
    arc[start angle=-190,end angle=170,radius=0.3] node[above left]{$C_1$};
    \draw[postaction={draw,-{stealth[bend,length=1mm]}},fill=white] (2,2.2) + (-90:0.2)
    arc[start angle=-90,end angle=280,radius=0.3]node[below]{$C_2$};;;
    \draw[postaction={draw,-{stealth[bend,length=1mm]}},fill=white] (4,2) + (-90:0.2)
    arc[start angle=90,end angle=480,radius=0.3]node[above]{$C_3$};;;
    \draw[postaction={draw,-{stealth[bend,length=1mm]}},fill=white] (2.3,.75) + (-90:0.2)
    arc[start angle=-10,end angle=350,radius=0.3] node[right]{$C_k$};;
    \path (.5,1.5) node[bullet,label=right:$a$]{} (2,2.2) node[bullet,label=right:$b$]{}
          (4,2) node[bullet,label=right:$a$]{} (2.3,.75) node[bullet,label=right:$b$]{};
    \end{tikzpicture}

在此处输入图片描述

答案1

我只想通过 添加弯曲箭头postaction。在我看来,直箭头在曲线上看起来并不好。

\documentclass[border=3mm,tikz]{standalone}
\usetikzlibrary{arrows.meta,bending}
\usetikzlibrary{hobby}
\begin{document}

\begin{tikzpicture}[bullet/.style={circle,fill,inner sep=0.6pt,outer sep=0pt},node font=\tiny,
    every label/.append style={inner sep=0pt}]
\path[gray!40, fill=gray!20,draw,use Hobby shortcut,closed=true,scale=.75]
                      (0,1) .. (1,3) .. (3,3) .. (4,2) .. (4.5,.5) .. (4,0) .. (3,.2) .. (1,0);
\draw[postaction={draw,-{Stealth[bend,length=1mm]}},fill=white] 
    (1,1.2) + (-90:0.2) arc[start angle=-90,end angle=280,radius=0.2];
\draw[postaction={draw,-{Stealth[bend,length=1mm]}},fill=white] 
    (2,1.2) + (-90:0.2) arc[start angle=-90,end angle=280,radius=0.2];
\path   (1,1.2) node[bullet,label=right:$a$]{}
(2,1.2) node[bullet,label=right:$b$]{};
\end{tikzpicture}

\end{document}

在此处输入图片描述

附录

\documentclass[border=3mm,tikz]{standalone}
\usetikzlibrary{arrows.meta,bending}
\usetikzlibrary{hobby}
\begin{document}
\begin{tikzpicture}[bullet/.style={circle,fill,inner sep=0.6pt,outer sep=0pt},node font=\tiny,
    every label/.append style={inner sep=0pt}]
\path[gray!40, fill=gray!20,draw,use Hobby shortcut,closed=true]
                      (0,1.5) .. (1.5,3) .. (3,3) .. (5,2) .. (4.5,.5) .. (4,0) .. (3.2,.2) .. (1,0);
\draw[postaction={draw,-{stealth[bend,length=1mm]}},fill=white] 
(.5,1.5) + (-190:0.3) arc[start angle=-190,end angle=170,radius=0.3] node[above left]{$C_1$};
\draw[postaction={draw,-{stealth[bend,length=1mm]}},fill=white] (2,2.2) + (-90:0.3)
arc[start angle=-90,end angle=280,radius=0.3]node[below]{$C_2$};
\draw[postaction={draw,-{stealth[bend,length=1mm]}},fill=white] (4,2) + (90:0.3)
arc[start angle=90,end angle=480,radius=0.3]node[above]{$C_3$};
\draw[postaction={draw,-{stealth[bend,length=1mm]}},fill=white] (2.3,.75) + (-10:0.3)
arc[start angle=-10,end angle=350,radius=0.3] node[right]{$C_k$};
\path (.5,1.5) node[bullet,label=right:$a$]{} (2,2.2) node[bullet,label=right:$b$]{}
      (4,2) node[bullet,label=right:$a$]{} (2.3,.75) node[bullet,label=right:$b$]{};
\end{tikzpicture}
\end{document}

在此处输入图片描述

您可以使用 来简化事情pic

\documentclass[border=3mm,tikz]{standalone}
\usetikzlibrary{arrows.meta,bending}
\usetikzlibrary{hobby}
\begin{document}
\begin{tikzpicture}[bullet/.style={circle,fill,inner sep=0.6pt,outer sep=0pt},node font=\tiny,
    every label/.append style={inner sep=0pt},
    pics/pole/.style={code={
            \tikzset{pole pars/.cd,#1}%
            \def\pv##1{\pgfkeysvalueof{/tikz/pole pars/##1}}%
            \draw[postaction={draw,-{stealth[bend,length=1mm]}},fill=white]
             (\pv{angle}-\pv{orientation}*20:\pv{radius}) 
             arc[start angle=\pv{angle}-\pv{orientation}*20,end
             angle=\pv{angle}+\pv{orientation}*360,radius=\pv{radius}];
    }},pole pars/.cd,radius/.initial=0.3,angle/.initial=-90,
    orientation/.initial=1,
    clockwise/.code={\tikzset{pole pars/orientation=-1}}]
\path[gray!40, fill=gray!20,draw,use Hobby shortcut,closed=true]
                      (0,1.5) .. (1.5,3) .. (3,3) .. (5,2) .. (4.5,.5) .. (4,0) .. (3.2,.2) .. (1,0);
\draw (.5,1.5) pic{pole={angle=160}} 
     node[bullet,label=right:$a$]{} ++(135:0.3)  node[above left]{$C_1$}
 (2,2.2) pic{pole={angle=-90}} node[bullet,label=right:$b$]{}
    ++(-90:0.3) node[below]{$C_2$}
 (4,2) pic{pole={angle=100}} node[bullet,label=right:$a$]{}
    ++(90:0.3) node[above]{$C_3$}
 (2.3,.75) pic{pole={angle=310}}  node[bullet,label=right:$b$]{}
 ++(00:0.3) node[right]{$C_k$};
\end{tikzpicture}
\end{document}

相关内容