Geoscience Reference
In-Depth Information
yields contour matrix
c
and a handle
h
that can be used as input to the
function
clabel
, which labels contours automatically.
clabel(c,h)
Alternatively, the plot can be labeled manually by selecting the
manual
option
in the function
clabel
. h is function places labels onto locations that have
been selected with the mouse. Labeling is terminated by pressing the
return
key.
[c,h] = contour(XI,YI,ZI,v);
clabel(c,h,'manual')
Filled contours are an alternative to the empty contours used above. h is
function is used together with
colorbar
, which displays a legend for the plot.
In addition, we can plot the locations (small circles) and
z
-values (contour
labels) of the true data points (Fig. 7.6).
contourf(XI,YI,ZI,v), colorbar, hold on
plot(data(:,1),data(:,2),'ko')
text(data(:,1)+1,data(:,2),labels), hold off
A pseudocolor plot is generated using the function
pcolor
. Black contours
are also added at the same levels as in the above example.
pcolor(XI,YI,ZI), shading flat, hold on
contour(XI,YI,ZI,v,'k'), hold off
h e third dimension is added to the plot using the
mesh
command. We can
also use this example to introduce the function
view(az,el)
to specify the
direction of viewing, where
az
is the azimuth or horizontal rotation and
el
is the elevation (both in degrees). h e values
az
=-37.5 and
el
=30 dei ne the
default view for all 3D plots,
mesh(XI,YI,ZI), view(-37.5,30)
whereas
az
=0 and
el
=90 is directly overhead and the default 2D view:
mesh(XI,YI,ZI), view(0,90)
h e function
mesh
provides one of many methods available in MATLAB for
3D presentation, another commonly used function being
surf
. h ei gure may
be rotated by selecting the
Rotate 3D
option on the
Edit Tools
menu. We also
introduce the function
colormap
, which uses predei ned color look-up tables
for 3D graphics. Typing
help graph3d
lists a number of built-in colormaps,
although colormaps can also be arbitrarily modii ed and generated by the
user. As an example we use the colormap
hot
, which is a
black-red-yellow-