Graphics, Figures & TablesArc from node to node.

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
white_owl
Posts: 12
Joined: Wed Apr 21, 2010 6:56 pm

Arc from node to node.

Post by white_owl »

I need to draw an arc from one node to another, but however I choose angles for the arc() command, I can not seem to finish on my target node. And I am starting to think there should be another way to do it. Here is the graph I am trying to draw:

Code: Select all

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}
\tikzstyle{dot} = [fill,draw, circle, minimum size=2pt, inner sep=0pt]
\node[dot, label=above:$a$] (a) {};
\node[dot, label=right:$b$] (b) [below right=of a] {};
\node[dot, label=above left:$d$] (d) [below left=of b] {};
\node[dot, label=below:$c$] (c) [below right=of d] {};
\node[dot, label=below:$e$] (e) [below left=of d] {};
\node[dot, label=left:$f$] (f) [above left=of d] {};
\draw (f) -- (a) -- (b) -- (f) -- (e) -- (c) -- (b) -- (d) --
     (e) to[out=160,in=180] (a)
      -- (d) -- (c);
\end{tikzpicture}

\end{document}
As you can see, the part of the path between nodes (e) and (a) has some kind of curving, but it does not look like an arc and it goes right across the label for node (f).
Is there a better way to draw path from (e) to (a) which will go around label for node (f) for sure, and will not force me to guess angles for the arc() command?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Arc from node to node.

Post by frabjous »

Does it need to be an arc, precisely, or will an approximating Bézier curve suffice? I have in mind something like:

Code: Select all

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}
\tikzstyle{dot} = [fill,draw, circle, minimum size=2pt, inner sep=0pt]
\node[dot, label=above:$a$] (a) {};
\node[dot, label=right:$b$] (b) [below right=of a] {};
\node[dot, label=above left:$d$] (d) [below left=of b] {};
\node[dot, label=below:$c$] (c) [below right=of d] {};
\node[dot, label=below:$e$] (e) [below left=of d] {};
\node[dot, label=left:$f$] (f) [above left=of d] {};
\draw (f) -- (a) -- (b) -- (f) -- (e) -- (c) -- (b) -- (d) --
     (e)  .. controls +(-1,1) and +(-2,0) .. (a) 
      -- (d) -- (c);
\end{tikzpicture}

\end{document}
It does seems like there should be a way to do it with the arc command, but I don't know how offhand. Maybe someone else will.
white_owl
Posts: 12
Joined: Wed Apr 21, 2010 6:56 pm

Re: Arc from node to node.

Post by white_owl »

Thank you very much.
That looks exactly like the picture I wanted.
white_owl
Posts: 12
Joined: Wed Apr 21, 2010 6:56 pm

Arc from node to node.

Post by white_owl »

Actually no. In this particular case, the controls command was enough.
In my next graph I need to draw something very similar but the arc should be almost full circle, so two points of controls is not enough...

Let's say, how to add to the previous example nice overhead arcs from node (e) to (b) and from (e) to (c)?
Post Reply