3

I know many of the layouts in Tikz can be rotated, but I fail to do it with the Layered Layout.

I have a very large chart that takes a lot of space horisontally, and i believe it would look better vertically.

I don't just want to rotate the model as i want to be able to read the label of every item.

Result of diagram

(Sorry, I know the code is not very minimal)

% !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}
  • Does adding grow=right, components go down left aligned to the \graph options produce the required output? – Mark Wibrow Sep 8 '17 at 13:15
  • It kinda works, although it places the 2 charts besides each other (the one i use as a legend, and the big one). I guess i will try to make it with just one. – Nichlas H. Sep 13 '17 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.