Revision 495
(checked in by cbc, 12 years ago)
|
Initial import of Stark code.
|
Line | |
---|
1 |
function cslicecolor2linestyle(h) |
---|
2 |
%CSLICECOLOR2BW(H) Function takes the handles of patches returned by CONTOURSLICE |
---|
3 |
% and alters the contour slice such that each color corresponds to a LineSpec. |
---|
4 |
% The LineSpec is {'-','--',':','-.'}, and repeats through the colors found in the |
---|
5 |
% contour slice. |
---|
6 |
% |
---|
7 |
% Calls: none |
---|
8 |
|
---|
9 |
% Find all the unique colors |
---|
10 |
colors = get(h,'cdata'); |
---|
11 |
colors=unique(cat(1,colors{:})); |
---|
12 |
colors=colors(~isnan(colors)); |
---|
13 |
|
---|
14 |
% Loop through all the patches returned by CONTOURSLICE, and designate a linestyle for each |
---|
15 |
% Define the line style (note that this can be changed since the code is written generally) |
---|
16 |
linespec = {'-','--',':','-.'}; |
---|
17 |
linestyles = repmat(linespec,1,ceil(length(colors)/length(linespec))); |
---|
18 |
linestyles = {linestyles{1:length(colors)}}; |
---|
19 |
|
---|
20 |
for n=1:length(h) |
---|
21 |
% Find the unique color number associated with the handle |
---|
22 |
color = find(max(get(h(n),'cdata'))==colors); |
---|
23 |
% Convert the color to the associated linestyle |
---|
24 |
linestyle = linestyles{color}; |
---|
25 |
set(h(n),'linestyle',linestyle); |
---|
26 |
end |
---|