Message Boards Message Boards

0
|
6996 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Control Vertex Labeling within GraphPlot

Hi all, 
I have difficulties in controlling the VertexLabelling when plotting a Graph via GraphPlot. I would like to control the Printing of the vertexlabels, wirth some useage of VertexRenderingFunction. Eg. I have a Petersengraph with yellow disks as vertices:

GraphPlot[pete[[1]], VertexCoordinateRules -> pete[[2]],  
VertexRenderingFunction -> ({EdgeForm[{Thick, Red}], FaceForm[Yellow], Disk[#1, 0.1], Text[#2, #1]} &),
EdgeRenderingFunction -> ({Blue, Line[#1]} &)] 

"pete" is my Petersengraph ;-)  I used the VertexRenderingFunction as shown in the documentation, but now I would like to control the font and the size of the font in the vertexlabeling. When I tried to do so I realized that I do not understand in full what the "Text[#2, #1]" in this statement does - I could not manage to work the Style command on that Text-Command. Can anyone give me a hint?

Greetings from rainy Germany

Mike
POSTED BY: Michael Gamer
2 Replies
Posted 11 years ago
Mike, apply the Style function to the #2 argument of Text[#2,#1] you mentioned as in:
GraphPlot[{1 -> 2, 2 -> 3, 3 -> 1},
VertexCoordinateRules -> {1 -> {0, 0}, 2 -> {0, 1}, 3 -> {1, 0}},
VertexRenderingFunction -> ({White, EdgeForm[Black], Disk[#, 0.1],
     Text[Style[#2, Black, FontFamily -> "Helvetica",
       FontSize -> 18], #1]} &)]
POSTED BY: Lee Johnston
Thank you, Lee, this helped me, but I forgot to post a reply -  so thanks again :-)

Greetings from Germany


Mike
POSTED BY: Michael Gamer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract