如何在 tikz 中绘制此图?

如何在 tikz 中绘制此图?

在此处输入图片描述

我是 Latex 初学者,您能帮我在 tikz 中绘制这个图表吗?

答案1

就像练习一样:

\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usetikzlibrary{positioning, calc, arrows.meta}
\tikzset{
    mynode/.style={draw=red, rounded corners, thick},
    myredline/.style={draw=red, thick},
    }

\begin{document}
    \begin{tikzpicture}
        \matrix[
            matrix of nodes,
            column sep=6em,
            nodes in empty cells,
            nodes={
                text centered,
                text width=6em,
                text height=1.75ex,
                text depth=.25ex,
                },
            ] (m) {
            100\% & |[mynode]|Next Coupon & |[mynode]|\dots & |[mynode]|100\% + \dots \\[5ex]
            0 & & \dots & \dots \\
            LCD & NCD && \\
        };
        \foreach \pos in {1,2,3,4}{
            \draw (m-1-\pos) -- (m-2-\pos);
        }
        \foreach \pos in {2,3,4}{
            \draw[myredline] (m-1-\pos) -- +(0,4ex);
        }
        \draw ($(m-1-1)!0.5!(m-2-1)$) -- ($(m-1-4)!0.5!(m-2-4)$);
        \draw[myredline] ($(m-1-4)+(0,4ex)$) -- node[red, above] {Atualiza\c c\~ao} ($(m-1-2)+(0,4ex)$);
        \coordinate (between1and2) at ($(m-1-1)!0.5!(m-1-2)$); 
        \draw[myredline, -Latex] ($(m-1-2)+(0,4ex)$) -- ($(between1and2)+(0,4ex)$) -- (between1and2) -- (m-1-1);
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容