为 tikz 边缘设置另一个弯曲点

为 tikz 边缘设置另一个弯曲点

在左侧,您可以看到一个 tikz 图形,其中的弯曲边缘放置得不太理想。有没有办法将边缘放置得与右侧的插图有点相似?

这是左侧图像的代码:

\documentclass{standalone}
\usepackage{tikz}
\begin{document}

    \begin{tikzpicture}
    % nodes
    \node (A) at (0,0) {A};
    \node (B) at (-1,1) {B};
    \node (C) at (-1,3) {C};
    \node (D) at (0,3.5) {D};
    \node (E) at (0,5) {E};
    \node (F) at (-1,4.5) {F};

    % just for illustration
    \node (here would be a lot more) at (0.5,2) {...};

    % draw edges 
    \draw[->]
        (A) edge (B) 
        (B) edge (C)
        (C) edge (D) edge (F)
        (D) edge (E)
        (F) edge (E);

    % weird edge that should be fixed
    \draw[->]
        (A) edge[bend left=130] node[midway,above, sloped] {FIX ME} (F);
    \end{tikzpicture}

\end{document}

答案1

当然。再补充一点。

\documentclass{standalone}
\usepackage{tikz}
\begin{document}

    \begin{tikzpicture}
    % nodes
    \node (A) at (0,0) {A};
    \node (B) at (-1,1) {B};
    \node (C) at (-1,3) {C};
    \node (D) at (0,3.5) {D};
    \node (E) at (0,5) {E};
    \node (F) at (-1,4.5) {F};

    % just for illustration
    \node (here would be a lot more) at (0.5,2) {...};

    % draw edges 
    \draw[->]
        (A) edge (B) 
        (B) edge (C)
        (C) edge (D) edge (F)
        (D) edge (E)
        (F) edge (E);

    % weird edge that should be fixed
    \draw[->]
        (A) to[out=-110,in=-60]++ (-2,0) to[out=120,in=150] 
        node[pos=0.4,above, sloped] {FIX ME} (F);
    \end{tikzpicture}

\end{document}

在此处输入图片描述

顺便说一句,如果您使用,文本会看起来更漂亮decorations.text

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\begin{document}

    \begin{tikzpicture}
    % nodes
    \node (A) at (0,0) {A};
    \node (B) at (-1,1) {B};
    \node (C) at (-1,3) {C};
    \node (D) at (0,3.5) {D};
    \node (E) at (0,5) {E};
    \node (F) at (-1,4.5) {F};

    % just for illustration
    \node (here would be a lot more) at (0.5,2) {...};

    % draw edges 
    \draw[->]
        (A) edge (B) 
        (B) edge (C)
        (C) edge (D) edge (F)
        (D) edge (E)
        (F) edge (E);

    % weird edge that should be fixed
    \draw[<-,postaction={decoration={text along path, text={FIX ME},text
    align={center},raise=0.2cm},decorate}] (F) to[out=-150,in=150]
    ([xshift=-1em]F|-A) to[out=-30,in=-150] (A);
    \end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容