-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshowGridSizeVsCells.m
38 lines (31 loc) · 1.07 KB
/
showGridSizeVsCells.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function showGridSizeVsCells(places,gridSizes,saveFigures)
% Produces a figure to show how the ratio of x_lat and x_lon grid cells varies with grid size assignment across cities
%
% INPUT:
% places (String) - Names of polygon areas in OpenSteetMap
% gridSizes(i) (Integer Array) - Array of Grid granularity in metres
% saveFigures (boolean) - Optional boolean switch for saving figures
% OUTPUT:
% Image of a cities vs average ratio of total lon/lat grid cells
% with standard deviation indicated
% EXAMPLE:
% showGridSizeVsCells({'London','Manchester','Bristol'},[100:100:4000],true)
sigma = 0;
p = length(places);
g = length(gridSizes);
cells = zeros(g,p);
for i = 1:p
for j = 1:g
[m,n] = size(getPopulationGrid(places{i},gridSizes(j),sigma));
cells(j,i) = n/m;
end
end
figure;
boxplot(cells,places);
xlabel('Place');
ylabel('x_{lon}/x_{lat}');
if saveFigures
set(gcf,'Position', [0, 0, 800, 300]);
set(gcf, 'Color', 'w');
export_fig(['./figures/point/plot-gridSizeVsCells.pdf']);
end