Can I plot a digraph on a geomap?
9 views (last 30 days)
Show older comments
Hey there!
Similar to the question asked here (https://www.mathworks.com/matlabcentral/answers/472642-undirected-graph-network-with-latitude-and-longitude-as-node), I want to know if there is a way I could apply a digraph on geomap.
I couldn't find a way to create nodes with coordinate data (lat & lon), and thus gave arbitary ids (1,2,3...) for the nodes instead. After creating an array of targets (with similar id information), I make an arbitary array of weights and then plot it the graph.
G = digraph(s,t,w,);
plot(G, 'XData',x,'YData',y)
Because the problem is originally a geo problem, my x and y data is in the form of coordinates. However, is there a way to connect this information to GeoAxes so that I can tell Matlab to "accurately" overlay the digraph over the geomap?
A (probably messy) of doing it is to use an image as a background - which (I'm guessing) won't be reliable when reszing the plot.
--
PS: I've read the blog post (https://www.mathworks.com/matlabcentral/answers/472642-undirected-graph-network-with-latitude-and-longitude-as-node), while helpful for sure, Loren uses polygons to create the map of the US, which is overkill for what I want to achieve.
PPS: If you need some more info, please let me know in case I must've missed out anything.
2 Comments
Christofer Pankratz
on 6 Sep 2023
Edited: Christofer Pankratz
on 6 Sep 2023
+1
while it's not an ideal solution, but could work for your purpose as well
Answers (0)
See Also
Categories
Find more on Geographic Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!