%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Program to plot 4 x-axes on one plot to creat a hydrographic % plot of ctd data. % 5/7/09 % % Erin R. Twomey % US Geological Survey % etwomey@usgs.gov %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% figure(gcf) set(gcf,'pos',[10 80 600 675]); set(gcf,'color','white'); % Define the varaibles. load MC_4_Apr_08_mf.mat depth = data(:,4); %y-variable temp = data(:,5); %x1 salinity = data(:,1); %x2 density = data(:,2); %x3 bat = data(:,3); %x4 beam attenuation % Plot the axes. theDefaultColor = get(0, 'DefaultAxesColor'); a(1) = axes; h(1) = plot(temp, depth, 'r'); set(gca,'YLim',[0 350]) set(gca, 'YDir', 'reverse','XAxisLocation','bottom'); set(gca, 'TickDir', 'in', 'Color', theDefaultColor) xlabel('Temperature (^oC)','color','red') pos = get(gca, 'Position') set(gca,'Position',[pos(1) pos(2)+0.2 pos(3) pos(4)-0.2]) a(2) = axes; h(2) = plot(density, depth, 'b'); %set(gca, 'YDir', 'reverse', 'XAxisLocation', 'bottom'); set(gca, 'YDir', 'reverse') set(gca, 'TickDir', 'in', 'Color', 'none') set(gca, 'Position', pos) set(gca,'Position',[pos(1) pos(2)+0.2 pos(3) pos(4)-0.2]) set(gca, 'YTickLabel', []) set(gca, 'XTick', 0) a(3) = axes; h(3) = plot(salinity, depth, 'g'); %set(gca, 'YDir', 'reverse', 'XAxisLocation', 'bottom'); set(gca, 'YDir', 'reverse') set(gca, 'TickDir', 'in', 'Color', 'none') %set(gca, 'Position', pos) set(gca,'Position',[pos(1) pos(2)+0.2 pos(3) pos(4)-0.2]) set(gca, 'YTickLabel', []) set(gca, 'XTick', 0) a(4) = axes; h(4) = plot(bat, depth, 'c'); %set(gca, 'YDir', 'reverse', 'XAxisLocation', 'bottom'); set(gca, 'YDir', 'reverse') set(gca, 'TickDir', 'out', 'Color', 'none') %set(gca, 'Position', pos) set(gca,'Position',[pos(1) pos(2)+0.2 pos(3) pos(4)-0.2]) set(gca, 'YTickLabel', []) set(gca, 'XTick', 0) pos=get(gca,'position') shift=[0 0.09 0 -0.09] pos=pos+shift; %set(gca,'position',pos) axes('position', [pos(1:3)-1.78*(shift(1:3)) 0.01]) new_axis=density; set(gca,'XLim',[min(new_axis) max(new_axis)]) set(gca, 'TickDir', 'in') set(gca, 'YTickLabel', []) xlabel('Denisty (kg/m^3)','color','b') set(gca,'YTick',0) set(gca,'box','off') %set(gca,'position',pos) axes('position', [pos(1:3)-2.55*(shift(1:3)) 0.01]) new_axis=salinity; set(gca,'XLim',[min(new_axis) max(new_axis)]) xlabel('Salinity (psu)','color','green') set(gca, 'TickDir', 'in') set(gca,'box','off') set(gca,'YTick',0) set(gca, 'YTickLabel', []) %set(gca,'position',pos) axes('position', [pos(1:3)-3.3*(shift(1:3)) 0.01]) new_axis=bat; set(gca,'XLim',[min(new_axis) max(new_axis)]) xlabel('Beam Attenuation (1/m)','color','cyan') set(gca,'YTick',0) set(gca, 'YTickLabel', []) set(gca, 'TickDir', 'in') set(gca,'box','off')