1

I am tryinf to make a multi-connected region in tikz. The arrow on the circle inside is weirdly tilted or angled somehow. as can be seen in the zoomed picture. I coloured them so that it can be seen easily. enter image description here

enter image description here

Here is what I want to achieve(something like this).

enter image description here

Look at the arrow on the circle they are nicely aligned. How to make to look like that. Thank you. Here is the code

    \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}

The New Code

    \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}

enter image description here

2

I would just add bent arrows via postaction. Straight arrows look IMHO never great on curves.

\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}

enter image description here

ADDENDUM

\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}

enter image description here

You can simplify things with a 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}
| improve this answer | |
  • Thank you very much – Kumarm Mar 30 at 2:51
  • Hi, I see these are not circles. Considering them as a circle how to I display their centres ? Like the one in the picture.? – Kumarm Mar 30 at 3:38
  • @Kumarm These are circles, drawn as arcs in order to attach the arrow. The centers of the circles did not change. Please see the update for how to add the labeled bullets. – Schrödinger's cat Mar 30 at 3:45
  • Hi, I am sorry to keep bothering you. But its not exactly working for me as i needed. I have changed the radius and some stuff and centres are not as expected. You can see the updated code. – Kumarm Mar 30 at 4:02
  • @Kumarm You cannot use different parameters for the offset and arc. See my next update. – Schrödinger's cat Mar 30 at 4:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.