Page 130 - Basics of MATLAB and Beyond
P. 130

3. Add the property you want to set for this type of object (for exam-
                                    ple, LineWidth, FaceColor, FontSize).

                                  We fix ideas with an example.
                                  Suppose we do not like the default figure settings that produce plots
                               in a white Axes box on a gray Figure background. Instead you want
                               transparent Axes plotted on a parchment-coloured background. You
                               also want to increase the size of the font used to label the axes. To
                               set these preferences for every graphic you draw, change these default
                               properties:
                               set(0,’DefaultFigureColor’,[0.95 0.9 0.8])    % parchment
                               set(0,’DefaultAxesColor’,’none’)
                               set(0,’DefaultAxesFontSize’,12)
                               (Capitalization is not essential.) The Axes font size setting affects all
                               text associated with Axes objects: tick labels, axis labels and titles, but
                               not Text objects or text on uicontrols. If you want to change these as
                               well, you could issue the commands:

                               set(0,’DefaultUIControlFontSize’,12)
                               set(0,’DefaultTextFontSize’,12)

                                  These sorts of commands often go in your startup.m file, where they
                               are executed each time matlab starts.

                               31.3   Current Objects

                               In matlab graphics there are alway three “current” objects: the current
                               Figure, the current Axes, and the current Object. The current Figure or
                               Axes objects are the ones that the next gaphical object will be drawn in.
                               The current Object is the last one drawn or clicked on with the mouse.
                               Figures or axes can also be made current by clicking on them with the
                               mouse. We have already used the functions that return the handle of the
                               current Axes object (gca) and the current Figure object (gcf). There
                               is also a gco command that returns the handle of the current Object.
                               These three commands are essentially abbreviations of:
                                              gcf:   get(0,’CurrentFigure’)
                                              gca:   get(gcf,’CurrentAxes’)
                                              gco:   get(gcf,’CurrentObject’)

                                    Exercise 15 Can you explain the difference between the follow-
                                    ing two methods of getting the current figure handle after doing a
                                    close all? (Answer on page 191.)

                                    >> close all
                                    >> get(0,’currentfigure’)



                               c   2000 by CRC Press LLC
   125   126   127   128   129   130   131   132   133   134   135