% % Example on epage XXX % % Problem on epage 517 % % Written by: % -- % John L. Weatherwax 2008-02-20 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- clear all; close all; clc; addpath('../../Code/CSTool'); randn('seed',0); rand('seed',0); % Loads up two vectors: okwhx, okwhy % These are event locations for the pattern. load okwhite % Get the convex hull. % -- K is the indices to points ON the convex hull K = convhull(okwhx, okwhy); cvh = [okwhx(K), okwhy(K)]; amts = unifrnd(1,100,1,length(okwhx)); % <- generate the amounts of each theft plot(okwhx,okwhy,'k.',cvh(:,1),cvh(:,2),'k') title('Location (and values) of Thefts by Caucasian Offenders') % add the labels: figure(gcf); hold on; for ti=1:length(okwhx), text( okwhx(ti),okwhy(ti), sprintf('%.2f',amts(ti)) ); end %figure(gcf); saveas( gcf, '../../WriteUp/Graphics/Chapter12/prob_12_1_w_labels', 'epsc' ); clear functions;