I'm new to Mathematica yet have coded a lot in MATLAB. Currently I'm working on a network simulation. My model is implemented in MATLAB, but I need to port it to Mathematica.

Here is my question:

Given a graph g and coordinates x and y for each node. I want to plot the network with nodes at the corresponding coordinates. How can this be done?

In case you are also used to MATLAB, there is the function gplot, which does the job. Is there a similar plotting function in Mathematica?

  • $\begingroup$ Maybe it's a case for AdjacencyMatrix[]. Please take a look at this post. $\endgroup$
    – Rod
    Jun 18, 2013 at 15:43
  • 2
    $\begingroup$ Or GraphPlot, using VertexCoordinateRules to specifiy coordinates? (See Documentation Center) $\endgroup$ Jun 18, 2013 at 15:45
  • $\begingroup$ Out of curiosity, what are you simulating? Unfortunately neither Mathematica not MATLAB are great at simulations (they're too slow), but Mma is great for analysis and visualization. $\endgroup$
    – Szabolcs
    Jun 18, 2013 at 16:00
  • $\begingroup$ The latter is the reason I'm switching to Mathematica. The model I'm working is of theoretical interest only: I want to see, whether there will be segregation in different types of dynamic networks. $\endgroup$
    – user8115
    Jun 18, 2013 at 16:16
  • $\begingroup$ @user8115 If you already have your simulation code in MATLAB and just want to do the analysis/visualization in Mathematica, you can consider using MATLink (shameless self promotion ;-) Note: MATLink has good support for sparse arrays, in case you represent graphs using those. $\endgroup$
    – Szabolcs
    Jun 18, 2013 at 17:47

1 Answer 1


Here's an example:

Graph[{1, 2}, {1 <-> 2}, VertexCoordinates -> {{0, 0}, {1, 1}}]

Pass the vertex list, edge list, and VertexCoordinates -> vertexCoordinateList to Graph. The coordinate list is in the same order as the vertex list.

  • $\begingroup$ What if the coordinate list is unordered?For example, a set of circular coordinates that are out of order. $\endgroup$
    – shelure21
    Jun 27, 2020 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.