Message Boards Message Boards

Creating a new GraphStyle—possible?

Posted 7 years ago

Hello everyone,

I found this feature example page, which unfortunately seems to be empty in all versions I have installed.

https://reference.wolfram.com/language/example/CreateYourOwnGraphStyle.html

I was wondering if this meant that it was possible to create a custom GraphStyle that can then be easily re-used.

I know that I could use an explicit option list with {VertexStyle -> ..., EdgeStyle -> ..., ...}. After finding this example page, I simply became curious if there was a builtin feature to give a set of styles a name.

POSTED BY: Szabolcs Horvát
2 Replies
POSTED BY: Szabolcs Horvát

Thank you for reporting this. I think that page meant regular options. No custom GraphStyle. I usually resort to something like below. I hope people will realize a neat trick which will become obvious if you remove AspectRatio->1. This is a method to keep vertex size scaled relevant to 'Graphics` size and not stretched. Some may find also THIS useful.

style={
    DirectedEdges->True,
    GraphStyle->"Prototype",
    VertexLabels->Placed["Name",Center],
    GraphLayout->"RadialEmbedding",
    VertexSize->Scaled[.07],
    AspectRatio->1
};

TreeGraph[RandomInteger[#] <-> # + 1 & /@ Range[0, 25], style]

enter image description here

POSTED BY: Vitaliy Kaurov
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