2

I am trying to do this picture:

enter image description here

But I am having problems doing the "circle", I have tried different things and my best try is:

\documentclass[12pt]{article}
\usepackage{tikz}

\begin{document}
\begin{figure}[ht]
\centering
\begin{tikzpicture}
\draw[black] plot[smooth,tension=.8]
  coordinates{(0,0) (0,1) (1,1.8) (2,2) (5,2) (7,0) (6,-2) (4,-2.5) (2,-2.1) (1,-1.6) (0,0) };

\end{tikzpicture}
\end{figure}
\end{document}

But is not as smooth as the one I am needing. Any ideas will help.

TeemoJg
  • 883

1 Answers1

2

You might want to use fewer coordinates, and smooth cycle.

\documentclass[12pt]{article}
\usepackage{tikz}

\begin{document}
\begin{figure}[ht]
\centering
\begin{tikzpicture}[bullet/.style={circle,fill,inner sep=2pt}]
\draw[black] plot[smooth cycle,tension=.8]
  coordinates{(0,1)  (2,2.5) (5,2) (6.5,0) (5,-2.5) (1,-1.6)};
 \draw[thick] (1,-0.5) node[bullet,label=left:$q$]{} to[out=40,in=175] 
    (4.8,0.5) node[bullet,label=right:$p$]{};
\end{tikzpicture}
\end{figure}
\end{document}

enter image description here

Or with the arrow.

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings,arrows.meta,bending}
\tikzset{% 
    attach arrow/.style={
    decoration={
        markings,
         mark=at position 0 with {\pgfextra{%
         \pgfmathsetmacro{\tmpArrowTime}{\pgfkeysvalueof{/tikz/arc arrow/length}/(\pgfdecoratedpathlength)}%
         \xdef\tmpArrowTime{\tmpArrowTime}}},
        mark=at position {#1-3*\tmpArrowTime} with {\coordinate(@1);},
        mark=at position {#1-2*\tmpArrowTime} with {\coordinate(@2);},
        mark=at position {#1-1*\tmpArrowTime} with {\coordinate(@3);},
        mark=at position {#1+\tmpArrowTime/2} with {\coordinate(@4);
        \draw[-{Stealth[length=\pgfkeysvalueof{/tikz/arc arrow/length},bend]}] plot[smooth]
         coordinates {(@1) (@2) (@3) (@4)};},
        },
     postaction=decorate,
     },
     attach arrow/.default=0.5,
     arc arrow/.cd,length/.initial=2mm,
}

\begin{document}
\begin{figure}[ht]
\centering
\begin{tikzpicture}[bullet/.style={circle,fill,inner sep=2pt}]
\draw[black] plot[smooth cycle,tension=0.75]
  coordinates{(0,1)  (2,2.5) (5,2) (6.5,0) (5,-2.5) (1,-1.6)};
 \draw[thick,attach arrow=0.4] (1,-0.5) node[bullet,label=left:$q$]{} to[out=40,in=175] 
    node[pos=0.4,above] {$f$} (4.8,0.5) node[bullet,label=right:$p$]{};
\end{tikzpicture}
\end{figure}
\end{document}

enter image description here