% Name of EsGlobe track file
fname = 'example_esglobe_tracks.txt';

% Longitude limits of plot
% Can set lower bound to negative value for a plot that
% spans the prime meridian
lons = [90, 270];

% Latitude limits of plot
lats = [0, 90];

% Read track data
d = load(fname);
t = d(:,1);
lat = d(:,2:2:end);
lon = d(:,3:2:end);

% Set negative longitudes (degrees west)
% to positive longitudes (degrees east)
% if both map limits are positive
if min(lons(:)) > 0
  lon(lon<0) = lon(lon<0) + 360;
end

% Set up map
figure('Position', [0, 0, 800, 400])
h = worldmap(lats, lons);
axis off;
setm(h, 'MapProjection','pcarree', 'MLabelParallel', 'south');

% Plot tracks and coastlines
plotm(lat,lon,'b-')
plotm(lat(1,:),lon(1,:),'bo')
plotm(lat(end,:),lon(end,:),'b*')
load coastlines;
plotm(coastlat, coastlon, 'k');

% Save figure
exportgraphics(gcf, 'example_esglobe_tracks.png')