TeX - LaTeX Asked by mistral on March 13, 2021
I am using graphdrawing tikz to create a small tree. In the MWE below, I would like to have a blue arrow pointing to B1 and an orange arrow pointing to B2. How could I do this?
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}
You can use B2[>orange]
to (specially) specify the incoming edge (the arrow) of B2
in orange. See pgfmanual
3.1.6a, sec. 19.6.4 Special Syntax for Options For Incoming and Outgoing Edges.
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}
Correct answer by muzimuzhi Z on March 13, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP