Search code examples
graphgraphvizdot

DOT notation rank not placing items on the same horizontal line/plane


This is what I'm going for: https://media-us.amboss.com/media/thumbs/big_58ac9ed16c2bf.jpg

And this is what I have (just the first bit of it for now):

digraph G {

"Palpable breast mass" -> "Age of patient?";
"Age of patient?" -> "Clinical assessment: probability of malignancy?" [label="< 30yo"];
"Clinical assessment: probability of malignancy?" -> "Reexamine 3-10 days after onset of menstruation" [label="Low"];
"Reexamine 3-10 days after onset of menstruation" -> "Ultrasound and/or FNA" [label="Suspicious mass"];
"Clinical assessment: probability of malignancy?" -> "Ultrasound and/or FNA" [label="High"];
"Ultrasound and/or FNA" -> "Mammography" [label="No visualization possible"];
"Age of patient?" -> "Mammography" [label="> 30yo"];
"Mammography" -> "Ultrasound and/or FNA" [label="Inconclusive"];
{rank=1;
"Palpable breast mass";
}
{rank=2;
"Age of patient?";
}
{rank=3;
"Clinical assessment: probability of malignancy?";
}
{rank=4;
"Reexamine 3-10 days after onset of menstruation";
"Ultrasound and/or FNA";
"Mammography";
}
}

However, the ranks aren't matching up in the way I want. I would like for all the items in rank=4 to be on the same horizontal line/plane. Here is what it looks like instead:

enter image description here


Solution

  • Nevermind, I realized that I need to write rank=same in each bracket instead of an actual value. Like this:

    {rank=same;
    "Palpable breast mass";
    }
    {rank=same;
    "Age of patient?";
    }
    {rank=same;
    "Clinical assessment: probability of malignancy?";
    }
    {rank=same;
    "Reexamine 3-10 days after onset of menstruation";
    "Ultrasound and/or FNA";
    "Mammography";
    }
    

    enter image description here