plot3dhillshades#

plot3dhillshades(x, y, z, plottype)

Description#

Plot hillshades (shaded relief) of x (longitude), y (latitude) and z (elevation) data

Inputs#

x
x (longitude) data extracted from xyz file
Set x=[] if it is not available
It may be 1d or 2d array
y
y (latitude) data extracted from xyz file
Set y=[] if it is not available
It may be 1d or 2d array
z

z (elevation) data extracted from xyz file

plottype=’imagesc’;
Plot type
‘imagesc’: 2 dimensional plot using imagesc or imshow
‘pcolor’: 2 dimensional plot using pcolor
‘contour’: 2 dimensional contour plot, number of contour=ncolor
‘surface’: 3 dimensional surface plot

Outputs#

Examples#

[x,y]=meshgrid(linspace(-10,10,50),linspace(-10,10,50));
r=sqrt(x.^2+y.^2)+1e-10; %Add 1e-10 to prevent divide by 0
z=sin(r)./r;
plot3dhillshades(x,y,z,'imagesc')

[x,y]=meshgrid(linspace(-10,10,21),linspace(-10,10,21));
z=(sin(x)+sin(y))./(x+y+1e-10); %Add 1e-10 to prevent divide by 0
plot3dhillshades(x,y,z,'imagesc')

x(:,1)=10.*rand(1000,1);
y(:,1)=10.*rand(1000,1);
z=x.^2+y.^2;
plot3dhillshades(x,y,z,'imagesc')

References#