How to plot a variable with 3 dimensions.
2 views (last 30 days)
Show older comments
So the title doesn't really explain it very well, here is the script so far,
close all
clear all
clc
load colormap_anom.mat;
Global68=read_one_netcdf('ETOPO_dx_dy.nc');
LIG6=read_one_netcdf('ETOPO_LIG6_1y_ptrc_Y2600.nc');
LIG8=read_one_netcdf('ETOPO_LIG8_1y_ptrc_Y2600.nc');
depth=LIG6.deptht*(-1);
LIG6.Fer(find(LIG.Fer>1e4))=NaN;
LIG6Fe=LIG6.Fer*1000;
LIG8.Fer(find(LIG.Fer>1e4))=NaN;
LIG8Fe=LIG8.Fer*1000;
Feglobal68=(LIG6Fe-LIG8Fe);
I now want to plot Feglobal68 however it is three dimensions (360,180,31) so I can't. I want to plot it over the whole globe, so something like this,
contourf(Feglobal68(:,:,1));
However I don't want it to just be at the surface (',1), so next I've tried to add up the Feglobal68 at every depth level, at each coordinate and then plot that as so;
TotalFe=zeros(360,180,31)
for i=1:360
j=1:180
k=1:31
TotalFe(i,j,k)=Feglobal68(i,j,k)+Feglobal68(i,j,(k+1));
end
end
end
However it says 'index exceeds matrix dimensions'
Any ideas?
Thanks,
Alexandra
0 Comments
Answers (1)
Kaushik Lakshminarasimhan
on 15 Feb 2017
Even if you get Matlab to make a dense 3d plot, you cannot see through the surface so it might be futile. One alternative is to create a Matlab UI with a slider that allows you to select the depth level and plots the corresponding surface contour.
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!