%% Your job... which we've all but done for you!
% Make a NEW LiveScript that plots the location of your rocks, color-coded by sedimentary, igneous or metamorphic, properly titled and with comments for every line that you use in the way that we've built the examples above. Save that as yournetidl02 and submit to BlackBoard. Here's some thoughts to start.
% First, pick some colors and symbols. Collect what will be fed to the legend and title.

% Remember to set the last entry to 1 so it all gets evaluated
xver=[0 0 0 0 0 1];

% Prep work for labeling and annotation
cols={'r','b','g'};
symb={'o','v','s'};
legs={'sedimentary','igneous','metamorphic'};
tstring={'fjsimonsl02 Campus Rocks by rock type'};

% Assemble your data set. Rather than reading from any presaved filed, you could hand-type them below, for which again I suggest creating a cell.

% Sedimentary rock locations, my random examples (you supply your own!)
lox{1}=[529300     4466206;
        528978     4466250;
        528951     4466467];
% Igneous rock locations, my random examples (you supply your own!)
lox{2}=[528971     4466440;
        528976     4466440];
% Metamorphic rock locations, my random examples (you supply your own!)
lox{3}=[528980     4466248;
        529083     4466537;
        529075     4466541;
        528951     4466461];

% Figure out the referencing points! You'll need the function cat to collect all of the locations together, then use min and max to find the corners.

% Determine the minimum easting and northings across all rock types
mineastnorth=min(cat(1,lox{:}));
mineast=mineastnorth(1);
minnorth=mineastnorth(2);

% Now you can complete the prep work by making axis label strings ahead of time.

% Further prep work for labeling and annotation
xstring=sprintf('easting (m) from %i',mineast);
ystring=sprintf('northing (m) from %i',minnorth);

% And then, finally, you can do what the code ACTUALLY does, which is plot! Instead of reassigning the location to new, referenced variables, you can perform the subtraction inside of the plot command.

% For loop with the plot commands for each of the rock types
if xver(6)==1
    clf
    for index=1:length(lox)
        % lox{index} contains a rock type of index=1,2,3...
        % The FIRST column is their eastings, the SECOND column their northings
        % We reference to a sensible origin by subtracting the reference values inside of the plot command
        plot(lox{index}(:,1)-mineast,lox{index}(:,2)-minnorth,...
            'MarkerFaceColor',cols{index},'MarkerEdgeColor',cols{index},...
            'Marker',symb{index},'LineStyle','none')
        hold on
    end
    hold off
    grid on
end

% Inspect your plot. Looking about right? Then the labels, legend, and title are alrady there, and just need to be added.

% Use the prep-work label, legend and title strings to make the annotations all at the very end
if xver(6)==1
    tl=title(tstring);
    xl=xlabel(xstring);
    yl=ylabel(ystring);
    lg=legend(legs);
end

% Pleased? Now open up the axes just a tad, as we have done in the example.

if xver(6)==1
    % Final cosmetics
    axis tight
    % Old axis ranges, made by MATLAB
    xli=xlim; yli=ylim;
    % Percentage by which you are going to open them up a bit
    xperc=5; yperc=5;
    xspace=round([xli(2)-xli(1)]*xperc/100);
    yspace=round([yli(2)-yli(1)]*xperc/100);
    % New axis ranges, made by YOU
    nxli=xli+[-1 1]*xspace;
    nyli=yli+[-1 1]*yspace;
    % Apply those new axis ranges
    xlim(nxli); ylim(nyli);
    % Clean up
    set(gca,'TickDir','out','TickLength',[0.02 0.025]/2)
    [xl.FontSize,yl.FontSize,tl.FontSize]=deal(15);
    tl.Position=tl.Position+[0 yspace/1 0];
end

% Want to get massively fancy? Load the database of campus buildings, and add those to the plot

if xver(6)==1
    % Get the necessary files of the webpage
    websave('CampusBuildings.zip','http://geoweb.princeton.edu/people/simons/PIX/CampusBuildings.zip');
    % Now, leave MATLAB, make sure that the locally stored CampusBuildings.zip gets unzipped!
    !unzip -o CampusBuildings.zip
    % Then read it in
    S=shaperead('CampusBuildings/buildings_reprojected.shp');
    % And add it to the plot... but remember you need to subtract the reference!
    hold on
    plot([S.X]-mineast,[S.Y]-minnorth, 'k-')
    hold off
end