1 |
gforget |
1.1 |
function [varargout]=depthStretchPlot(plotName,plotData,varargin); |
2 |
|
|
%object: front end to plot/pcolor/etc. using a stretched depth coordinate (see depthStretch.m) |
3 |
|
|
%inputs: plotName is the name of the plotting routine (e.g. 'pcolor') |
4 |
|
|
% plotData is the list or arguments to pass over to the plotting routine |
5 |
|
|
% in a cell array (e.g. {depth,time,temperature}), with the |
6 |
|
|
% depth coordinate coming second (as usual for plot/pcolor/etc.) |
7 |
|
|
%optional: depthTics is the vector of yTics depths |
8 |
|
|
% depthStretchLim are the stretching depth limits ([0 500 6000] by default) |
9 |
|
|
% to pass over to depthStretch (type 'help depthStretch' for details). |
10 |
|
|
% |
11 |
|
|
%notes: the depth coordinate must be first in plotData |
12 |
|
|
|
13 |
|
|
%get depthStretchDef if provided |
14 |
|
|
if nargin>2; depthTics=varargin{1}; else; depthTics=[0:100:500 750 1000:500:6000]; end; |
15 |
|
|
if nargin>3; depthStretchDef=varargin{2}; else; depthStretchDef=[0 500 6000]; end; |
16 |
|
|
|
17 |
|
|
%replace it with stretched coordinate: |
18 |
|
|
plotData{2}=depthStretch(abs(plotData{2}),depthStretchDef); |
19 |
|
|
|
20 |
|
|
%do the very plot: |
21 |
|
|
eval(['h=' plotName '(plotData{:});']); |
22 |
|
|
|
23 |
|
|
%take care of depth tics in stretched coordinate: |
24 |
|
|
depthTics=sort(depthTics,'descend'); |
25 |
|
|
|
26 |
|
|
depthTicsLabel=[]; |
27 |
|
|
for kkk=1:length(depthTics) |
28 |
|
|
depthTicsLabel=strvcat(depthTicsLabel,num2str(depthTics(kkk))); |
29 |
|
|
end |
30 |
|
|
|
31 |
|
|
depthTics=depthStretch(depthTics,depthStretchDef); |
32 |
|
|
set(gca,'YTick',depthTics); |
33 |
|
|
set(gca,'YTickLabel',depthTicsLabel); |
34 |
|
|
|
35 |
|
|
%output plot handle: |
36 |
|
|
if nargout>0; varargout={h}; end; |
37 |
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
|