In the following example, I would appreciate some feedback on the best method for plotting the required outcome.
clear all
Table1 = {0.990,0.987,0.972,0.832,0.776,20;0.988,0.986,0.961,0.946,0.906,...
30;0.963,0.956,0.850,0.897,0.908,70;0.970,0.968,0.922,0.835,0.674,...
90;0.957,0.950,0.908,0.925,0.955,100;0.966,0.963,0.948784273781552,0.892,...
0.812,120;0.977,0.973,0.932,0.779,0.648,450;0.985,0.985,0.915,...
0.832,0.792,480;0.979,0.969,0.939,0.814,0.642,550;0.983,0.980,0.916,...
0.719,0.520,570;};
locations = {'loc1','loc2','loc3','loc4','loc5'};
CombLocation = locations(nchoosek(1:length(locations),2));
Table2 = [CombLocation,Table1];
Headings = {'location1','location2','depth1','depth2','depth3','depth4',...
'depth5','residence time'};
Table3 = [Headings;Table2];
depths = [5.3,6.8,16.3,24,16.78];
Here, we have ‘Table3’ which demonstrates the correlation values (of water temperature) between different locations (‘loc1′,’loc2’) being ranked according to ‘residence time’ (where residence time is the difference in residence time between the locations). What I would like to do is to show that as the depths increases, the level of coherency is greatly affected by the residence time.
This can be done for each depth individually e.g.
figure;
plot(cell2mat(Table3(2:11,8)),cell2mat(Table3(2:11,7)));
thus showing that as the residence time increases, the correlation decreases. This can then be repeated for a shallower depth i.e. depths(1) e.g.
figure;
plot(cell2mat(Table3(2:11,8)),cell2mat(Table3(2:11,3)));
However, I would like to produce one plot which showed that as the water depth increased, the locations with a higher level of coherency were those which had a smaller difference in residence time.
Any advice would be appreciated.
How about a surface plot?
This should show what you want, although your
depthsarray looks strange since it isn’t sorted, which makes the surface cut back underneath itself. You could fix this with:but this makes the surface look strange (since a depth of 16.78 seems to have lower correlation than depth of 24).
Replacing
[X Y] = meshgrid(depths, residences);with[X Y] = meshgrid(1:numel(depths), residences);might make sense if you just want to show what happens depth increases (otherwise we get a big gap between depth = 6.8 and depth = 16.3).You can also experiment with removing
shading interpand replacingsurf(X, Y, correlations)with something liketo get a scatter plot instead.