I'm looking to graph a simple one-way Markov chain, which is effectively a decision tree with transitions probabilities. One way I've got this working in here in an MWE, here's a simple Markov chain for different outcomes of a simple test:
t1 = {0, p, 1 - p, 0, 0, 0, 0, 0, 0};
t2 = {0, 0, 0, 1, 0, 0, 0, 0, 0};
t3 = {0, 0, 0, 0, 1, 0, 0, 0, 0};
t4 = {0, 0, 0, 0, 0, s, 1 - s, 0, 0};
t5 = {0, 0, 0, 0, 0, 0, 0, h, 1 - h};
t6 = {0, 0, 0, 0, 0, 1, 0, 0, 0};
t7 = {0, 0, 0, 0, 0, 0, 1, 0, 0};
t8 = {0, 0, 0, 0, 0, 0, 0, 1, 0};
t9 = {0, 0, 0, 0, 0, 0, 0, 0, 1};
proc = DiscreteMarkovProcess[1, {t1, t2, t3, t4, t5, t6, t7, t8, t9}];
namelist = {"N", "Positive", "Negative", "Test", "Test", "TP", "FN", "TN", "FP" };
o = Graph[proc, VertexSize -> 0.7, VertexLabels ->Thread[Range[9] ->Map[Placed[Style[#, {Bold}],
Center] &, namelist ]], ImageSize -> Full, ImagePadding -> 25, EdgeLabels -> {DirectedEdge[i_, j_] :>
MarkovProcessProperties[proc, "TransitionMatrix"][[i, j]]}, VertexShapeFunction -> "Circle",
EdgeShapeFunction -> GraphElementData["FilledArrow", "ArrowSize" -> 0.01], EdgeLabelStyle -> Directive[Black, Bold, 14], PlotLabel -> "Possible test outcomes", LabelStyle -> {Directive[Bold], FontSize -> 40}]
If I run this, I generate a figure like so:
The problem is this is difficult to read. Is there a way to either get Mathematica to rotate this by 90 degrees OR to graph this as a decision tree with the centre circle N at the top layer, followed by positive and negative on the next etc? It is important the transition probabilities are displayed too. Any ideas welcome!
TreePlot
? $\endgroup$