在 tikz \graph 中更改圆角半径

在 tikz \graph 中更改圆角半径

我想rounded corner在我的 中指定 s的半径。我知道我可以使用显式命令\graph更改 a 的半径,但我还没有看到在图表中执行此操作的方法。rounded corner\draw

解决方案可能很简单,但我对 LaTex 和 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}

答案1

欢迎来到 TeX.SE!您快到了。我所做的就是将其更改edges=rounded cornersedges={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}

在此处输入图片描述

相关内容