TeX - LaTeX Asked by tsj on February 22, 2021
Is there some way to position a graph
in TikZ using an anchor that is defined relative to nodes in the graph? For example, I want to position the graph so that the upper left corner of the graph’s bounding box is at a specific point. I see in the manual you can set anchor here
and desired at
for a particular node in the graph, but I want to anchor elsewhere.
MWE:
documentclass{standalone}
usepackage{tikz}
usetikzlibrary{fit}
usetikzlibrary{shapes.misc}
usetikzlibrary{graphs}
usetikzlibrary{graphdrawing}
usegdlibrary{trees}
begin{document}
begin{tikzpicture}
node (A) [draw] at (1,1) {A};
graph [tree layout] {
root -> {
child 1, child 2
}
};
node [draw, dashed, gray, fit=(root)(child 1)(child 2), inner sep=0] {};
node [draw, cross out, red] (B) at (child 1.west |- root.north) {};
node [draw, cross out, green] (C) at (A.south east) {};
draw [->] (B) -- (C);
end{tikzpicture}
end{document}
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP