Message Boards Message Boards

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

Specify the coordinates of GraphPlot3D?

Posted 4 years ago

Hi?everyone! I want to draw a ladder graph, so I use the GridGraph[{2, 10}] . I'm especially looking forward to the new3D effects. So I use the GraphPlot3D, and I want to specify the coordinates in 3D graph. I want it to be output more regularly. How should I do? In graph, I know that to use the VertexCoordinates. But in 3D?I try but fail.

GridGraph[{2, 10}]
GraphPlot3D[EdgeList[GridGraph[{2, 10}]

enter image description here enter image description here

POSTED BY: Licheng Zhang
2 Replies
Posted 4 years ago

VertexCoordinates is usable in Graph3D[]:

pts = Flatten[PadRight[{{0, 0}, {1, 0}}, {2, 3}, #] & /@ Range[0, 9], 1];
Graph3D[EdgeList[GridGraph[{2, 10}]], VertexCoordinates -> pts]

However, if you insist on using GraphPlot3D[], the correct option to use is VertexCoordinateRules:

GraphPlot3D[GridGraph[{2, 10}], 
            VertexCoordinateRules -> MapIndexed[First[#2] -> #1 &, pts]]
POSTED BY: J. M.
Posted 4 years ago

Too many thanks to you! it solved my problem.

POSTED BY: Licheng Zhang
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