Drawing a graph in Latex/Tikz [closed]

How to draw the following picture in Latex/Tikz:

• Take one of my drawing (!) from tex.stackexchange.com/q/681418/245790 and check for "hair", "horn", "eye" etc. Then you can vary the line from straight to curved. See the tikz manual for modifying arrow tips. Apr 2, 2023 at 14:10
• Start to read basic TikZ tutorial. Then propose your partial solution and we will help you to go beyond. Apr 2, 2023 at 14:18
• Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
– Community Bot
Apr 2, 2023 at 14:22

No need for an AI to draw something like this.

\documentclass[tikz,border=3.14mm]{standalone}

\begin{document}
\begin{tikzpicture}[
dot/.style={
inner sep=0pt,
outer sep=1pt,
minimum width=4pt,
circle,
fill=black}]
\node[dot] (1) at (0,0) {};
\node[dot] (2) at (0,-5) {};
\draw[thick,->] (1) .. controls ++ (3,-2) and ++ (-3,2) .. (2);
\end{tikzpicture}
\end{document}

• It it possible to have more than one control point? Apr 2, 2023 at 19:19
• Alternative: \draw[thick, ->] (1) to[out=-30, in=150, looseness=2] (2);. Apr 2, 2023 at 20:39
• @JeanRobert There already is two control points on this curve. One for each vertex. If you want more flexibility, you'll have to define more vertices, then add control points around them. You could find more info by searching for Bezier curve. Apr 3, 2023 at 7:54

For what it's worth, an alternative with Metapost.

\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
beginfig(1);
z1 = -z2 = 30 up;
draw z1 withpen pencircle scaled 3;
draw z2 withpen pencircle scaled 3;
drawarrow z1 {dir -20} .. z2 {dir -20}
cutbefore fullcircle scaled 7 shifted z1
cutafter  fullcircle scaled 7 shifted z2;
endfig;
\end{mplibcode}
\end{document}


Compile with lualatex to get:

Since it seems you're drawing a commutative diagram, a solution with tikz-cd:

\documentclass{article}
\usepackage{tikz-cd}
\tikzset{mydot/.style={% style copied from SebGlav's answer
inner sep=0pt,
outer sep=1pt,
minimum width=4pt,
circle,
fill=black}
}

\begin{document}
$\begin{tikzcd}[ every matrix/.append style={ nodes in empty cells, nodes={mydot} }, row sep=3cm, ] \ar[d,out=0,in=180]\\ \end{tikzcd}$
\end{document}


For anybody out there - who like me does not know so much about TikZ - here is the answer I got from an AI:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[scale=2,rotate=90]
\draw[thick, ->, shorten <= 4pt, shorten >= 4pt]
(0.5,0) .. controls (0.25,-0.5)
and
(-0.25,0.5) .. (-0.5,0)
node[pos=0.5, above left] {$f$};
\filldraw[black]
(-0.5,0) circle (1pt) node[above] {$A$};
\filldraw[black] (0.5,0)
circle (1pt) node[below] {$B$};
\end{tikzpicture}

\end{document}


From this example, it's easy to see how basic curved arrows work, and how to build them in general.

• How was the question that you made to the generator? Apr 2, 2023 at 15:23
• I asked for an S-shaped curve between two vertical points. I took some subsequent suggestions, but I got there eventually. Apr 2, 2023 at 15:39
• Why would you rotate everything by 90 degrees and not define the coordinates directly in a proper way? The mysteries of artificial intelligence ... Apr 2, 2023 at 20:36