彩色箭头绘图

彩色箭头绘图

我在用绘图tikz 创建一棵小树。在下面的 MWE 中,我希望有一个指向 B1 的蓝色箭头和一个指向 B2 的橙色箭头。我该怎么做?

\documentclass[tikz,border=10pt]{standalone}

\usetikzlibrary{graphdrawing}
\usetikzlibrary{graphs}
\usegdlibrary{trees}

\newcommand{\eg}{\textit{e.g., }}

\begin{document}
\begin{tikzpicture}[>=stealth, every node/.style={minimum size=0.75cm}]
\graph [tree layout, grow=down, fresh nodes, level distance=0.5in, sibling distance=0.5in]
    {
        Model -> {
            "A1" ->[very thick, blue] {B1 -> {C, D}, B2},
            A2 -> {C}
        } 
    };
\end{tikzpicture}
\end{document}

答案1

您可以使用(特别)指定橙色B2[>orange]的入边(箭头) 。请参阅3.1.6a,第 19.6.4 节B2pgfmanual传入和传出边选项的特殊语法

\documentclass[tikz,border=10pt]{standalone}

\usetikzlibrary{graphdrawing}
\usetikzlibrary{graphs}
\usegdlibrary{trees}

\newcommand{\eg}{\textit{e.g., }}

\begin{document}
\begin{tikzpicture}[>=stealth, every node/.style={minimum size=0.75cm}]
\graph [tree layout, grow=down, fresh nodes, level distance=0.5in, sibling distance=0.5in]
    {
        Model -> {
            "A1" ->[very thick, blue] {B1 -> {C, D}, B2[>orange]},
            A2 -> {C}
        } 
    };
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容