简体   繁体   中英

Matlab: plotting a directed graph

I'd like to draw a rectangular grid with arrows pointing from each cell to its 4 neighbors. It can also be a directed graph with nodes and labelled edges. Any suggestions to do this in a less tedious way?

Edit: I am not interested in exporting Matlab data to third party tools.

mdpgrid

使用Matlab编写一个.dot文件,然后使用GraphViz呈现该文件。

If you are OK with directed graphs:

It should be pretty straight forward to use biograph for this.

Hope it helps!

Edit: I'm not sure if this is feasible in your case, but you can adjust the topology using dolayout .

   % Manually modify the node position and recalculate the paths.
   bg.nodes(1).Position = [150 150];
   dolayout(bg,'PathsOnly',true)
   view(bg)

If you create a function that assigns appropriate X,Y coordinates, you might achieve what you want.

-Rob

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM