Graphics Programs Reference
In-Depth Information
Text Properties... in the Tools menu (in MATLAB 5.3), or else the menu
item Figure Properties... in the Edit menu (in MATLAB 6), can be used to
change the font style and font size.
Change of Viewpoint
Another common and important way to vary a graphic is to change the view-
point in 3-space. This can be done with the command view , and also (at least
in MATLAB 5.3 and higher) by using the Rotate3D option in the Tools menu
at the top of the figure window. The command view(2) projects a figure into
the x - y plane (by looking down on it from the positive z axis), and the com-
mand view(3) views it from the default direction in 3-space, which is in the
direction looking toward the origin from a point far out on the ray z = 0 . 5 t ,
x =− 0 . 5272 t , y =− 0 . 3044 t , t > 0.
In MATLAB, any two-dimensional plot can be “viewed in 3D,” and
any three-dimensional plot can be projected into the plane. Thus
Figure 5-5 above (the helix), if followed by the command view(2) ,
produces a circle.
Change of Plot Style
Another important way to change the style of graphics is to modify the color or
line style in a plot or to change the scale on the axes. Within a plot command,
one can change the color of a graph, or plot with a dashed or dotted line, or
mark the plotted points with special symbols, simply by adding a string as a
third argument for every x - y pair. Symbols for colors are 'y' for yellow, 'm'
for magenta, 'c' for cyan, 'r' for red, 'g' for green, 'b' for blue, 'w' for
white, and 'k' for black. Symbols for point markers include 'o' for a circle,
'x' for an X -mark, '+' for a plus sign, and '*' for a star. Symbols for line
styles include '-' for a solid line, ':' for a dotted line, and '--' for a dashed
line. If a point style is given but no line style, then the points are plotted but
no curve is drawn connecting them. The same methods work with plot3 in
place of plot . For example, one can produce a solid red sine curve along witha
dotted blue cosine curve, marking all the local maximum points on each curve
with a distinctive symbol of the same color as the plot, as follows:
>> X = (-2:0.02:2)*pi; Y1 = sin(X); Y2 = cos(X);
>> plot(X, Y1, 'r-', X, Y2, 'b:'); hold on
>> X1 = [-3*pi/2 pi/2]; Y3 = [1 1]; plot(X1, Y3, 'r+')
>> X2 = [-2*pi 0 2*pi]; Y4 = [1 1 1]; plot(X2, Y4, 'b*')
Search WWH ::




Custom Search