Message Boards Message Boards


Convenient way to set multiple properties of a graph

Posted 9 years ago
2 Replies
4 Total Likes

It is very easy to set or change multiple options of a graphics objects with Show:

Show[g, Frame -> True, Axes -> False, PlotRange -> All, ...]

One may often want to do this with Graphs. It's been always bothering me that I can't see an easy way to do it. Now that I took the time to think about it and write up a question, one idea that came to mind is:

  EdgeStyle -> Directive[Thick, Orange],
  VertexStyle -> White,
  GraphLayout -> "SpringElectricalEmbedding"

It's still rather tedious compared to how easy it is to use Show.

Is there a recommended official way to do this type of graph manipulation? Is there a better, easier way than above?

POSTED BY: Szabolcs Horvát
2 Replies

Thank you Vitaliy, I knew there had to be a simpler solution!

I would like to suggest adding an additional function signature to the documentation. Now it mentions

SetProperty[{obj, itemspec}, name -> value]

only. It would be helpful to also list

SetProperty[{obj, itemspec}, {name1 -> value1, name2 -> value2, ...}]

below it, to make this easier to find.

POSTED BY: Szabolcs Horvát

This produced an identical output for me on versions 9 and 10:

 {EdgeStyle -> Directive[Thick, Orange],
  VertexStyle -> White,
  GraphLayout -> "SpringElectricalEmbedding"}]

enter image description here

Does this work for you? This documentation example points to that.

POSTED BY: Vitaliy Kaurov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract