4
$\begingroup$

Is there any way to rotate the vertex labels within a LayerdGraphPlot by, say, 20 degrees without affecting the rest of the plot?

stuff = {};
AppendTo[stuff, "Product 1" -> "Process"];
AppendTo[stuff, "Product 2" -> "Process"];
AppendTo[stuff, "Process" -> "Result"];
plot = LayeredGraphPlot[stuff, VertexLabeling -> True, DirectedEdges -> True]

I wasn't able to find anything. Rotate[] only affects the entire plot. There is a PlotStyle attribute, but I can't think of any way to use that the effect the desired result.

$\endgroup$
  • 4
    $\begingroup$ plot /. f_Framed :> Rotate[f, 20. Degree] $\endgroup$ – Kuba Jun 15 '17 at 14:19
  • $\begingroup$ Related: (13541) $\endgroup$ – Mr.Wizard Jun 15 '17 at 18:40
  • 2
    $\begingroup$ If you are using the newer Graph with GraphLayout -> "LayeredDigraphEmbedding" instead of the old LayeredGraphPlot, you can use VertexLabels -> Placed["Name", Center, Rotate[#, Pi/2] &] as a starting point. $\endgroup$ – Szabolcs Jun 15 '17 at 20:41
5
$\begingroup$

You can use the VertexRenderingFunction option:

LayeredGraphPlot[
    stuff,
    VertexRenderingFunction->({Text[Framed[#2,Background->White],#1,{0,0},{0,1}]}&)
]

enter image description here

$\endgroup$
4
$\begingroup$

Also

LayeredGraphPlot[Rotate[#, 90 Degree] & /@ # & /@ stuff, 
 VertexLabeling -> True, DirectedEdges -> True]

Mathematica graphics

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.