我知道 Tikz 中的许多布局都可以旋转,但我无法使用分层布局。
我有一张非常大的图表,它在水平方向上占用了很多空间,我相信它在垂直方向上看起来会更好。
我不只是想旋转模型,因为我希望能够读取每个项目的标签。
(抱歉,我知道代码不是很简单)
% !TeX program = lualatex
\documentclass[tikz]{standalone}
%\documentclass{article}
\usepackage{luatex85}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{graphs}
\usetikzlibrary{graphdrawing}
\usegdlibrary{layered}
\begin{document}
\tikz [
nodes={
text height=.7em,
text depth=.2em,
draw=black!20,
thick,
fill=white,
align=center,
font=\footnotesize
},
>=stealth,
rounded corners,
thick,
]
\graph [
layered layout,
level distance=4cm,
sibling sep=1em,
sibling distance=1cm
] {
Usage -- "Farm Plot" [fill=green!20] -- "Still" [fill=yellow!20] -- "Farmer's Workshop" [fill=blue!20] -- "Millstone\slash Quern" [fill=red!20] -- "Kitchen" [fill=brown!20];
% Above Ground Crops
"Above Ground" [draw,scale=1.5] -> {
"Longland Grass" [fill=green!20],
"Whip Vine" [fill=green!20],
"Sun Berry" [fill=green!20],
"Fisher Berry" [fill=green!20],
"Bloated Tuber" [fill=green!20],
"Prickle Berry" [fill=green!20],
"Muck Root" [fill=green!20],
"Wild Strawberry" [fill=green!20],
"Rope Reed" [fill=green!20],
"Rat Weed" [fill=green!20],
"Silver Barb" [fill=green!20],
"Valley Herb" [fill=green!20],
"Kobold Bulb" [fill=green!20],
"Hide Root" [fill=green!20],
"Blade Weed" [fill=green!20]
};
"Longland Grass" -> {
"Longland Flour" [> minimum layers=3,fill=red!20],
"Longland Beer" [fill=yellow!20]
};
"Longland Flour" -> "Ration" [fill=brown!20];
"Longland Beer" -> "Alcohol" [fill=black!20];
"Whip Vine" -> {
"Whip Wine" [fill=yellow!20],
"Whip Vine Flour" [> minimum layers=3,fill=red!20]
};
"Whip Wine" -> "Alcohol";
"Whip Vine Flour" -> "Ration";
"Sun Berry" -> {
"Sunshine" [fill=yellow!20],
"Raw Food" [fill=black!20]
};
"Sunshine" -> "Alcohol";
"Fisher Berry" -> {
"Fisher Berry Wine" [fill=yellow!20],
"Raw Food" [> minimum layers=2],
};
"Fisher Berry Wine" -> "Alcohol";
"Bloated Tuber" -> {
"Tuber Beer" [fill=yellow!20],
"Raw Food"
};
"Tuber Beer" -> "Alcohol";
"Prickle Berry" -> {
"Prickle Berry Wine" [fill=yellow!20],
"Raw Food"
};
"Prickle Berry Wine" -> "Alcohol";
"Muck Root" -> {
"Swamp Whiskey" [fill=yellow!20],
"Raw Food"
};
"Swamp Whiskey" -> "Alcohol";
"Wild Strawberry" -> {
"Strawberry Wine" [fill=yellow!20],
"Raw Food"
};
"Strawberry Wine" -> "Alcohol";
"Rope Reed" -> {
"River Spirits" [fill=yellow!20],
"Rope Reed Threads" [> minimum layers=2,fill=blue!20]
};
"Rope Reed Threads" -> Thread [fill=black!20];
"River Spirits" -> Alcohol;
"Rat Weed" -> {
"Sewer Brew" [fill=yellow!20],
"Raw Food"
};
"Sewer Brew" -> "Alcohol";
"Silver Barb" -> {
"Gutter Cruor" [fill=yellow!20],
"Black Dye"[> minimum layers=3,fill=red!20]
};
"Gutter Cruor" -> "Alcohol";
"Black Dye" -> "Dye" [fill=black!20];
"Valley Herb" -> {
"Raw Food",
"Golden Salve" [> minimum layers=2,fill=blue!20]
};
"Golden Salve" -> "Export" [fill=black!20];
"Kobold Bulb" -> "Gnomeblight" [fill=blue!20] -> "Export";
"Hide Root" -> "Redroot Dye" [> minimum layers=3,fill=red!20] -> "Dye";
"Blade Weed" -> "Emerald Dye" [> minimum layers=3,fill=red!20] -> "Dye";
"Alcohol" -> "Ration";
"Raw Food" -> "Ration";
% Subteranean Crops
"Subteranean" [draw,scale=1.5] -> {
"Quarry Bush" [fill=green!20],
"Cave Wheat" [fill=green!20],
"Plump Helmet" [fill=green!20],
"Pig Tail" [fill=green!20],
"Sweet Pod" [fill=green!20],
"Dimple Cup" [fill=green!20]
};
"Quarry Bush" -> "Quarry Bush Leaves" [fill=blue!20] -> "Ration";
"Cave Wheat" -> {
"Dwarven Beer" [fill=yellow!20],
"Dwarven Wheat Flour" [> minimum layers=3,fill=red!20]
};
"Dwarven Beer" -> "Alcohol";
"Dwarven Wheat Flour" -> "Ration";
"Plump Helmet" -> {
"Dwarven Wine" [fill=yellow!20],
"Raw Food"
};
"Dwarven Wine" -> "Alcohol";
"Pig Tail" -> {
"Dwarven Ale" [fill=yellow!20],
"Pig Tail Thread" [fill=blue!20]
};
"Pig Tail Thread" -> "Thread";
"Dwarven Ale" -> Alcohol;
"Sweet Pod" -> {
"Dwarven Rum" [fill=yellow!20],
"Dwarven Sugar" [> minimum layers=3,fill=red!20]
};
"Dwarven Rum" -> Alcohol;
"Dwarven Sugar" -> Ration;
"Dimple Cup" -> "Dimple Dye" [> minimum layers=3,fill=red!20] -> Dye;
};
\end{document}