Page 102 - A Guide to MATLAB for Beginners and Experienced Users
P. 102

Customizing and Manipulating Graphics         83


                       This “one at a time” method for locating and modifying figure properties
                     can be speeded up using the command findobj to locate the handles of all
                     the descendents (the main figure window, its children, children of children,
                     etc.) of the current figure. One can also limit the search to handles containing
                     elements of a specific type. For example, findobj(’Type’, ’Line’) hunts
                     for all handles of objects containing a Line element. Once one has located
                     these, set can be used to change the LineStyle from solid to dashed, etc.
                     In addition, the low-level graphics commands line, rectangle, fill,
                     surface, and image can be used to create new graphics elements within a
                     figure window.
                       As an example of these techniques, the following code creates a chessboard
                     on a white background, as shown in Figure 5-11:

                       >> white = [1 1 1]; gray = 0.7*white;
                       >>a=[0110];b=[0011];c=[1111];







































                              Figure 5-11
   97   98   99   100   101   102   103   104   105   106   107