Contour chart appearance and behavior
FunctionContour properties control
the appearance and behavior of
FunctionContour objects. By changing property values, you
can modify certain aspects of the contour chart.
ContourMatrix— Contour line definitions
(default) | two-row matrix
This property is read-only.
Contour line definitions, returned as a two-row
matrix. Each contour line in the plot has an
associated definition. If the plot has a total of
N contour lines, then the
contour matrix consists of
C = [C(1) C(2)...C(k)...C(N)]
C(k) = [level x(1) x(2)... numxy y(1) y(2)... ]
level, indicates the contour level where the contour line is drawn. Beneath the contour level is the number of (x,y) vertices that define the contour line. The remaining columns contain the data for each of the vertices. If the first and last vertices are the same, then the contour line is a closed loop. If a particular contour level has multiple contour lines in the graph, then the matrix contains a separate definition for each line.
Create a contour plot of
y^2. For demonstration purposes, use the
MeshDensity that results
in a plot, which is
h = fcontour(@(x,y) x.^2+y.^2, 'MeshDensity', 3); grid on
Access the contour matrix using the
ContourMatrix property of the
h.ContourMatrix). The contour
matrix contains definitions for each of the seven
contour lines. The circles in this matrix show the
beginnings of the contour line definitions.
The first definition in the
matrix indicates that there is a contour line
drawn at the
5 level ,
consisting of the five vertices
(1,0). Since the first and last
vertices are the same, the contour line is a
closed loop. The last definition indicates that
there is a point at the
level because the line starts and ends at the same
point with no intervening points.