function mapper = plotter2(data) %------------------------------------------------------------------------------------------ %************************** SUBROUTINE DESCRIPTION PLOTTER2.m ***************************** % PLOTTER.m is a subroutine of EXPAND.m but is designed to stand alone. It produces a % two-dimensional map of the cave system showing the survey line and the cave walls. % Input data is provided by EXPAND.m but can also be manually provided. The required % format is a matrix of 11 columns and n rows where n = the number of survey stations. % The data must be formatted as follows [ss x y z ztop zbot room xrtw yrtw xltw yltw]. % Further data description is provided at the top of the code for CONVERT.m. Data % describing side conduits stemming from the main conduit must be separated by a row % containing -999.9 in each column. %------------------------------------------------------------------------------------------ %**************************** DETERMINING SIZE OF INPUT DATA ****************************** [row,col] = size(data); %------------------------------------------------------------------------------------------ %******************************* EXTRACTING NECESSARY DATA ******************************** x = data(:,2); y = data(:,3); xrtw = data(:,8); yrtw = data(:,9); xltw = data(:,10); yltw = data(:,11); %------------------------------------------------------------------------------------------ %*********************************** ADDING END MARKER ************************************ % adding the -999.9 marker to the bottom of data if not present. if x(row) ~= -999.9; x(row+1) = -999.9; y(row+1) = -999.9; xrtw(row+1) = -999.9; yrtw(row+1) = -999.9; xltw(row+1) = -999.9; yltw(row+1) = -999.9; row = row + 1; end count = 1; %------------------------------------------------------------------------------------------ %******************************* ESTABLISHING UNITS AND CAVE NAME ************************* disp(' ') disp(' ') disp(' What units are to be used?') units = input(' Meters (m) or Feet (f) - - -[M] ', 's'); if isempty(units) units = 'M'; end if units == 'm' units = 'M'; end if units ~= 'M' units = 'f'; end name = input(' Enter the name of the cave ','s'); %------------------------------------------------------------------------------------------ %********************************** SETTING MAX AND MIN VALUES **************************** xm = 0; ym = 0; for i = 1:row if x(i) ~= -999.9 xm = [xm x(i) xrtw(i) xltw(i)]; ym = [ym y(i) yrtw(i) yltw(i)]; end end total = [abs(max(xm)) abs(min(xm)) abs(max(ym)) abs(min(ym))]; axischk = input('Do you want to enter axes dimensions? [Y/N] ','s'); if isempty(axischk) axischk = 'Y'; end if axischk == 'y' axischk = 'Y'; end if axischk == 'Y' xmax = input('Enter xmax '); xmin = input('Enter xmin '); ymax = input('Enter ymax '); ymin = input('Enter ymin '); else if max(total) > 5000 xmax = (round((max(xm) + 100) / 100)) * 100; xmin = (round((min(xm) - 100) / 100)) * 100; ymax = (round((max(ym) + 100) / 100)) * 100; ymin = (round((min(ym) - 100) / 100)) * 100; num = 100; else if max(total) > 1000 xmax = (round((max(xm) + 50) / 100)) * 100; xmin = (round((min(xm) - 50) / 100)) * 100; ymax = (round((max(ym) + 50) / 100)) * 100; ymin = (round((min(ym) - 50) / 100)) * 100; num = 100; else xmax = (round((max(xm) + 5) / 10)) * 10; xmin = (round((min(xm) - 5) / 10)) * 10; ymax = (round((max(ym) + 5) / 10)) * 10; ymin = (round((min(ym) - 5) / 10)) * 10; num = 10; end end end %------------------------------------------------------------------------------------------ %***************************** ADDING TO AN EXISTING PLOT? ******************************** addchk = input('Add this plot to an existing plot? [Y/N] ','s'); if isempty(addchk) addchk = 'Y'; end if addchk == 'y' addchk = 'Y'; end %------------------------------------------------------------------------------------------ %********************************* PLOTTING GRID LINES ************************************ gridchk = input(' Do you want to plot finely spaced grid lines? [Y/N] ','s'); if isempty(gridchk) gridchk = 'Y'; end if gridchk == 'y' gridchk = 'Y'; end if gridchk == 'Y' if addchk ~= 'Y' figure end axis([xmin xmax ymin ymax]) zoom on hold on step =0; for i = xmin:num:xmax step = step + num; xinc = xmin + step; xvert = [xinc xinc]; yvert = [ymin ymax]; plot(xvert,yvert,'w') xvert = 0; yvert = 0; end step = 0; for i = ymin:num:ymax step = step + num; yinc = ymin + step; xhorz = [xmin xmax]; yhorz = [yinc yinc]; plot(xhorz,yhorz,'w'); xhorz = 0; yhorz = 0; end else if addchk ~= 'Y' figure end axis([xmin xmax ymin ymax]) grid on zoom on hold on end %------------------------------------------------------------------------------------------ %************************************ PLOTTING DATA *************************************** % transects, wall lines, survey stations, and survey line. transchk = input('Do you want to plot transect lines? [Y/N] ','s'); if isempty(transchk) transchk = 'Y'; end if transchk == 'y' transchk = 'Y' end for i = 1:row if x(i) ~= -999.9 xltw_trans(count) = xltw(i); yltw_trans(count) = yltw(i); xrtw_plot(count) = xrtw(i); yrtw_plot(count) = yrtw(i); xx(count) = x(i); yy(count) = y(i); xwall = [xrtw(i) xltw(i)]; ywall = [yrtw(i) yltw(i)]; if transchk == 'Y' plot(xwall,ywall) end count = count + 1; else plot(xx,yy,'c') mark = count-1; for j = 1:count-1 xltw_new(j) = xltw_trans(mark); yltw_new(j) = yltw_trans(mark); mark = mark - 1; end xxx = [xrtw_plot xltw_new]; yyy = [yrtw_plot yltw_new]; plot(xxx,yyy,'b') xx = 0; yy = 0; xltw_new = 0; yltw_new = 0; xrtw_plot = 0; yrtw_plot = 0; count = 1; end end %------------------------------------------------------------------------------------------ %******************************* CREATING PLOT LABELS ************************************* if addchk ~= 'Y' title(name) if units == 'm' xlabel('x-direction (m)') ylabel('y-direction (m)') else xlabel('x-direction (ft)') ylabel('y-direction (ft)') end end %------------------------------------------------------------------------------------------ %******************************* END SUBROUTINE PLOTTER2.m ********************************