2

I try to draw a diagram showing how different areas communicate with each other. In the end it should have the areas labelled A1,...,A5 in a circle and there will be many labelled arrows between them. The code in the minimal working example below produces the correct style and the labels appear as I want them to but the arrows do not. Why not? Where has the arrow between A1 and A4 gone?

\documentclass[tikz]{standalone}
\usetikzlibrary{graphdrawing,graphs,quotes}
\usegdlibrary{circular}

\tikzset{
  every picture/.style={simple necklace layout, node distance=78pt},  
  new set=areas,
  area/.style n args={1}{set=areas, draw, circle,inner sep=1pt,node contents={A#1}},
  every edge/.style={rounded corners,nodes={font=\scriptsize,sloped}}
}

\begin{document}    
\begin{tikzpicture}
\foreach \i in {1,...,5} \node (A\i) [area={\i}] {};

\graph{
(areas);
A1 ->["communicate new standards"] A4
};
\end{tikzpicture}
\end{document}

I am looking for a solution which will allow me to keep the tikzset commands outside of the tikzpicture and/or graph environment as there will be many pictures with the same style in the final document.

1
  • 1
    Welcome to TeX.SE!
    – Mensch
    Oct 22, 2021 at 12:10

1 Answer 1

4

The default value of the every edge style is simply draw. In your redefinition of the style you've left out draw, so the path isn't actually drawn. Either add draw back in to the style, or use every edge/.append style instead of every edge/.style. With append style your options are added to the existing definition, rather than replacing it.

enter image description here

\documentclass[tikz]{standalone}
\usetikzlibrary{graphdrawing,graphs,quotes}
\usegdlibrary{circular}

\tikzset{
  every picture/.style={simple necklace layout, node distance=78pt},  
  new set=areas,
  area/.style n args={1}{set=areas, draw, circle,inner sep=1pt,node contents={A#1}},
  %%% use append style here,
  every edge/.append style={rounded corners, nodes={font=\scriptsize,sloped}}
}

\begin{document}    
\begin{tikzpicture}
\foreach \i in {1,...,5} \node (A\i) [area={\i}] {};

\graph{
(areas);
A1 ->["communicate new standards"] A4
};
\end{tikzpicture}
\end{document}
2
  • Why not .append style?
    – egreg
    Oct 22, 2021 at 21:24
  • @egreg Good point. No real reason, I guess the first thing that came to mind was to add draw. I'll edit :) Oct 22, 2021 at 21:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .