# LayeredGraphPlot how to change color of vertex box

For LayeredGraphPlot how to change the default yellow color?

LayeredGraphPlot[{"abc"->"123","abc"->"def"},VertexLabeling->True]

produces the vertex label in yellow box with yellow border. I want to change the color to gray box with gray border.

• You can also use Graph[..., GraphLayout -> "LayeredEmbedding"]. – Szabolcs Sep 28 '15 at 14:06

LayeredGraphPlot[{"abc" -> "18734523", "abc" -> "def"},
VertexLabeling -> True,
VertexRenderingFunction -> ({
Gray,
Text[Framed[Style[#2, 18, Black],
Background -> LightGray], #1]} &),
EdgeRenderingFunction -> ({Purple, Line[#1], Arrowheads[{0, .1}],
Arrow[#1, {0, .5}]} &)]


Here, Line[#1] takes the arguments from LayeredGraphPlot representing the beginning and end vertexes in question; Arrowheads[{0, .1}] says make the "tail" arrowhead of size zero (i.e., don't render it) and the "head" arrowhead of (scaled) size .1; and Arrow[#1, {0, .5}] makes an arrow with the same beginning and end points of the Line but sets the ends back $0$ from the starting vertex and (scaled) 0.5 of its length back from the target or end vertex.

• Thank you David, but increasing the length of vertex text makes it go outside the box. Also you are replacing the default box and not changing its properties. The default box changes its size with the text. – user13892 Sep 28 '15 at 13:58
• Thank you David, I will accept your answer but please can you also add to the code how to change the color of the arrows as well. – user13892 Sep 28 '15 at 14:36
• Hi David, Sometimes the arrowhead gets overlapped under the vertex box, can you please make the arrowhead in the middle of the line like it was in the default. – user13892 Sep 28 '15 at 15:30
• @user13892: Acceptable now? – David G. Stork Sep 28 '15 at 16:39
• Just a last thing, what does 0, 1, 0, 0.5 means in the code?? {Purple, Line[#1], Arrowheads[{0, .1}], Arrow[#1, {0, .5}]} – user13892 Sep 28 '15 at 16:41
Block[{RGBColor}, RGBColor[1, 1, 0.8] = LightGray;
RGBColor[0.94, 0.85, 0.36] = Gray; RGBColor[0.5, 0., 0.] = Purple;
LayeredGraphPlot[{"abc" -> "123456789", "abc" -> "def"},
VertexLabeling -> True, PlotStyle->Directive[FontSize->24, Arrowheads[{{0.1, 0.63}}]]]]