1 function drawCities (coordsMatrix)
3 % description: Draws a dot on the map for each city.
4 % author: Laurens Van Houtven <lvh@laurensvh.be>
7 % Extract coordinate vectors for easy access.
8 xCoords = coordsMatrix(:,2);
9 yCoords = coordsMatrix(:,3);
12 xAxisMin = 0; yAxisMin = 0;
13 [xAxisMax yAxisMax] = getAxisMaximums(xCoords, yCoords);
15 plot(xCoords, yCoords, 'or'); % draw red circles
16 axis([xAxisMin xAxisMax yAxisMin yAxisMax]);
23 function [xAxisMax, yAxisMax] = getAxisMaximums (xCoords, yCoords)
25 % description: Tries to find decent axis maximums for the given data.
26 % author: Laurens Van Houtven <lvh@laurensvh.be>
29 % Verbosity for debugging purposes.
33 xAxisMax = (ceil(max(xCoords)/10)+1)*10;
35 xAxisMax = (ceil(max(xCoords)/100)+1)*100;
39 yAxisMax = (ceil(max(yCoords)/10)+1)*10;
41 yAxisMax = (ceil(max(yCoords)/100)+1)*100;