This example shows how to display vector data as points and lines. Mapping Toolbox vector map display of line objects works much like MATLAB line display functions. Mapping Toolbox supports versions of many MATLAB functions that work with geographic coordinates and map projections.
Set up a map axes and frame.
load coastlines axesm mollweid framem('FEdgeColor','blue','FLineWidth',0.5)
Plot the coast vector data using plotm
and specify line property names and values.
plotm(coastlat,coastlon,'LineWidth',1,'Color','blue')
Define the three city geographic locations and plot symbols at these locations. Suppose you have variables representing the locations of Cairo (30 degrees N, 32 degrees E), Rio de Janeiro (23 degrees S, 43 degrees W), and Perth (32 degrees S, 116 degrees E), and you want to plot them as markers only, without connecting line segments. You can also use geoshow
(for data in geographic coordinates) or mapshow
(for data in projected coordinates) to create such maps in either a map axes or a regular axes.
citylats = [30 -23 -32]; citylongs = [32 -43 116];
plotm(citylats,citylongs,'r*')
Calculate and plot a great circle track from Cairo to Rio de Janeiro and a rhumb line track from Cairo to Perth.
[gclat,gclong] = track2('gc',citylats(1),citylongs(1),... citylats(2),citylongs(2)); [rhlat,rhlong] = track2('rh',citylats(1),citylongs(1),... citylats(3),citylongs(3)); plotm(gclat,gclong,'m-'); plotm(rhlat,rhlong,'m-')