I did not do anything manually - I simply uploaded your image to https://claude.ai and asked a few questions. For me most important thing is nice wrapping of labels around text which I saw in Tree[]
. It shrink-wraps frames of labels nicely around text so it is automatic and no manual specifications for the frames is not needed. Code is under the image. But you can do this with Graph[]
too. I give code for both.
Also for the future consider MermaidInk but it might be less flexible, not sure, needs check:
https://resources.wolframcloud.com/FunctionRepository/resources/MermaidInk
Final plots
Graph
Structure data:
data={
"Chapter 1" -> "Overview",
"Chapter 1" -> "QCO",
"Chapter 1" -> "Chaos",
"Chapter 1" -> "Chapter 2",
"Chapter 2" -> "Chapter2_Title1",
"Chapter 2" -> "Chapter2_Title2",
"Chapter 2" -> "Chapter 3",
"Chapter 3" -> "Chapter3_Title1",
"Chapter 3" -> "Chapter3_Title2",
"Chapter 3" -> "Chapter 4",
"Chapter 4" -> "Chapter4_Title1",
"Chapter 4" -> "Chapter4_Title2",
"Chapter 4" -> "Chapter 5",
"Chapter 5" -> "A",
"Chapter 5" -> "B",
"Chapter 5" -> "C",
"Chapter 5" -> "D"
};
Label coordinates data:
coor= {
"Chapter 1" -> {100, 500},
"Overview" -> {200, 525},
"QCO" -> {200, 500},
"Chaos" -> {200, 475},
"Chapter 2" -> {100, 400},
"Chapter2_Title1" -> {200, 425},
"Chapter2_Title2" -> {200, 375},
"Chapter 3" -> {100, 300},
"Chapter3_Title1" -> {200, 325},
"Chapter3_Title2" -> {200, 275},
"Chapter 4" -> {100, 200},
"Chapter4_Title1" -> {200, 225},
"Chapter4_Title2" -> {200, 175},
"Chapter 5" -> {100, 100},
"A" -> {200, 150},
"B" -> {200, 115},
"C" -> {200, 80},
"D" -> {200, 45}
};
Define a special graph with nice frames around labels:
ClearAll@LabeledGraph;
LabeledGraph[data_, opts:OptionsPattern[]] :=
Block[{g, vfunc},
g = Graph[data, VertexLabels->Automatic];
vfunc=(# -> With[{lab = #},
Inset[Framed[Style[lab, "StandardForm", "Output", FontColor -> Black,FontSize -> Scaled[0.05]],
Background -> RGBColor[1., 1., 0.871], FrameStyle -> GrayLevel[0.5]], #1]&]&)/@VertexList[g];
Graph[VertexList[g], EdgeList[g], VertexShapeFunction -> vfunc, opts, EdgeStyle -> Black]
]
Use it with your data:
LabeledGraph[data, VertexCoordinates -> coor,
EdgeShapeFunction -> {{"CarvedArrow", "ArrowSize" -> .1}}]
Tree
Tree["Chapter 1", {
Tree["Overview", {}],
Tree["QCO", {}],
Tree["Chaos", {}],
Tree["Chapter 2", {
Tree["Chapter2_Title1", {}],
Tree["Chapter2_Title2", {}],
Tree["Chapter 3", {
Tree["Chapter3_Title1", {}],
Tree["Chapter3_Title2", {}],
Tree["Chapter 4", {
Tree["Chapter4_Title1", {}],
Tree["Chapter4_Title2", {}],
Tree["Chapter 5", {
Tree["A", {}],
Tree["B", {}],
Tree["C", {}],
Tree["D", {}]
}]
}]
}]
}]
},
TreeElementCoordinates -> {
{} -> {100, 500}, (* Chapter 1 *)
{1} -> {200, 525}, (* Overview *)
{2} -> {200, 500}, (* QCO *)
{3} -> {200, 475}, (* Chaos *)
{4} -> {100, 400}, (* Chapter 2 *)
{4, 1} -> {200, 425}, (* Chapter2_Title1 *)
{4, 2} -> {200, 375}, (* Chapter2_Title2 *)
{4, 3} -> {100, 300}, (* Chapter 3 *)
{4, 3, 1} -> {200, 325}, (* Chapter3_Title1 *)
{4, 3, 2} -> {200, 275}, (* Chapter3_Title2 *)
{4, 3, 3} -> {100, 200}, (* Chapter 4 *)
{4, 3, 3, 1} -> {200, 225}, (* Chapter4_Title1 *)
{4, 3, 3, 2} -> {200, 175}, (* Chapter4_Title2 *)
{4, 3, 3, 3} -> {100, 100}, (* Chapter 5 *)
{4, 3, 3, 3, 1} -> {200, 150}, (* A *)
{4, 3, 3, 3, 2} -> {200, 115}, (* B *)
{4, 3, 3, 3, 3} -> {200, 80}, (* C *)
{4, 3, 3, 3, 4} -> {200, 45} (* D *)
}]