1

I'd like to specify the radius of rounded corners in my \graph. I know I can change the radius of a rounded corner with an explicit \draw command, but I haven't seen a way to do it in a graph.

The solution might be something simple, but I'm very new to LaTex and Tikz...

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, graphs, matrix}
\begin{document}

\begin{tikzpicture} [
  point/.style={ circle, inner sep=0pt, minimum size=2pt, fill=red },
  graphs/every graph/.style = { edges=rounded corners },
  hv path/.style = {to path={-| (\tikztotarget)}},
  >= stealth, black!50, text = black, thick,
]

\matrix (m) [row sep=1cm, column sep=1cm]
  {
    &
    \node (p1) [point] {}; &
    \\

    \node (p2) [point] {}; &
    &
    \\
  };
\graph [use existing nodes] {
  p2 --[hv path] p1
};

\end{tikzpicture}
\end{document}
0

Welcome to TeX.SE! You are almost there. All I did was to change edges=rounded corners to edges={rounded corners=5mm}.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, graphs, matrix}
\begin{document}

\begin{tikzpicture} [
  point/.style={ circle, inner sep=0pt, minimum size=2pt, fill=red },
  graphs/every graph/.style = { edges={rounded corners=5mm} },
  hv path/.style = {to path={-| (\tikztotarget)}},
  >= stealth, black!50, text = black, thick,
]

\matrix (m) [row sep=1cm, column sep=1cm]
  {
    &
    \node (p1) [point] {}; &
    \\

    \node (p2) [point] {}; &
    &
    \\
  };
\graph [use existing nodes] {
  p2 --[hv path] p1
};

\end{tikzpicture}
\end{document}

enter image description here

3
  • I was guessing I might need some escape/quote mechanism to do "rounded corners=X", but am so new to latex I couldn't come up with a plausible guess. Thanks.
    – TOertel
    Nov 3 '18 at 20:48
  • How should I have been able to figure that out? Is that based on LaTex syntax or some feature of tikz? I'm guessing LaTex, but confirmation would be helpful.
    – TOertel
    Nov 4 '18 at 13:57
  • @TOertel Yes, to some extent it is "just" (La)TeX. { starts a group and } ends it. That is, if you want to have a subscript "k>0", you say $A_{k>0}$ such that all of it becomes a subscript. The only additional information is how pgfkeys work, i.e. some of them have parameters, which are passed to them via <key>=<parameter>.
    – user121799
    Nov 4 '18 at 14:04

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.