Page 121 - Basics of MATLAB and Beyond
P. 121

There are usually a great many properties associated with a given
                               graphical object. For example the x- and y-axis limits are given by two
                               separate properties, xlim and ylim. Continuing with the example above:
                               >> get(gca,’xlim’)
                               ans  =
                                    0     10
                               >> get(gca,’ylim’)
                               ans  =
                                   -1     1
                               The locations of the x-axis tick marks are another property:

                               >> get(gca,’xtick’)
                               ans =
                                    0     2      4     6     8     10
                               The width of the line used to draw the axes is

                               >> get(gca,’linewidth’)
                               ans  =
                                   0.5
                               (Your line width might be different.) There are many more. To get
                               a complete list of the properties of a graphical object, leave out the
                               property argument in a call to get. For example, the properties of the
                               Axes object are
                               >> get(gca)
                                       AmbientLightColor = [1 1 1]
                                       Box = on
                                       CameraPosition = [3.5 0 17.3205]
                                       CameraPositionMode = auto
                                       CameraTarget = [3.5 0 0]
                                       CameraTargetMode = auto
                                       CameraUpVector = [0 1 0]
                                       (and so on)
                               And the properties of a Line object are (carrying on from the sine-wave
                               example above):

                               >> get(h)
                                       Color = [1 0 0]
                                       EraseMode = normal
                                       LineStyle = -
                                       LineWidth = [0.1]
                                       Marker = o
                                       MarkerSize = [6]



                               c   2000 by CRC Press LLC
   116   117   118   119   120   121   122   123   124   125   126