octave: Manipulation of Plot Windows

 
 15.2.7 Manipulation of Plot Windows
 -----------------------------------
 
 By default, Octave refreshes the plot window when a prompt is printed,
 or when waiting for input.  The ‘drawnow’ function is used to cause a
 plot window to be updated.
 
  -- : drawnow ()
  -- : drawnow ("expose")
  -- : drawnow (TERM, FILE, DEBUG_FILE)
      Update figure windows and their children.
 
      The event queue is flushed and any callbacks generated are
      executed.
 
      With the optional argument "expose", only graphic objects are
      updated and no other events or callbacks are processed.
 
      The third calling form of ‘drawnow’ is for debugging and is
      undocumented.
 
      See also: Seerefresh XREFrefresh.
 
    Only figures that are modified will be updated.  The ‘refresh’
 function can also be used to cause an update of the current figure, even
 if it is not modified.
 
  -- : refresh ()
  -- : refresh (H)
      Refresh a figure, forcing it to be redrawn.
 
      When called without an argument the current figure is redrawn.
      Otherwise, the figure with graphic handle H is redrawn.
 
      See also: Seedrawnow XREFdrawnow.
 
    Normally, high-level plot functions like ‘plot’ or ‘mesh’ call
 ‘newplot’ to initialize the state of the current axes so that the next
 plot is drawn in a blank window with default property settings.  To have
 two plots superimposed over one another, use the ‘hold’ function.  For
 example,
 
      hold on;
      x = -10:0.1:10;
      plot (x, sin (x));
      plot (x, cos (x));
      hold off;
 
 displays sine and cosine waves on the same axes.  If the hold state is
 off, consecutive plotting commands like this will only display the last
 plot.
 
  -- : newplot ()
  -- : newplot (HFIG)
  -- : newplot (HAX)
  -- : HAX = newplot (...)
      Prepare graphics engine to produce a new plot.
 
      This function is called at the beginning of all high-level plotting
      functions.  It is not normally required in user programs.
      ‘newplot’ queries the "NextPlot" field of the current figure and
      axes to determine what to do.
 
      Figure NextPlot    Action
      --------------------------------------------------------------------------
      "new"              Create a new figure and make it the current figure.
                         
      "add" (default)    Add new graphic objects to the current figure.
                         
      "replacechildren"  Delete child objects whose HandleVisibility is set
                         to "on".  Set NextPlot property to "add".  This
                         typically clears a figure, but leaves in place
                         hidden objects such as menubars.  This is equivalent
                         to ‘clf’.
                         
      "replace"          Delete all child objects of the figure and reset all
                         figure properties to their defaults.  However, the
                         following four properties are not reset: Position,
                         Units, PaperPosition, PaperUnits.  This is
                         equivalent to ‘clf reset’.
 
      Axes NextPlot      Action
      --------------------------------------------------------------------------
      "add"              Add new graphic objects to the current axes.  This
                         is equivalent to ‘hold on’.
                         
      "replacechildren"  Delete child objects whose HandleVisibility is set
                         to "on", but leave axes properties unmodified.  This
                         typically clears a plot, but preserves special
                         settings such as log scaling for axes.  This is
                         equivalent to ‘cla’.
                         
      "replace"          Delete all child objects of the axes and reset all
      (default)          axes properties to their defaults.  However, the
                         following properties are not reset: Position, Units.
                         This is equivalent to ‘cla reset’.
 
      If the optional input HFIG or HAX is given then prepare the
      specified figure or axes rather than the current figure and axes.
 
      The optional return value HAX is a graphics handle to the created
      axes object (not figure).
 
      *Caution:* Calling ‘newplot’ may change the current figure and
      current axes.
 
  -- : hold
  -- : hold on
  -- : hold off
  -- : hold (HAX, ...)
      Toggle or set the "hold" state of the plotting engine which
      determines whether new graphic objects are added to the plot or
      replace the existing objects.
 
      ‘hold on’
           Retain plot data and settings so that subsequent plot commands
           are displayed on a single graph.  Line color and line style
           are advanced for each new plot added.
 
      ‘hold all (deprecated)’
           Equivalent to ‘hold on’.
 
      ‘hold off’
           Restore default graphics settings which clear the graph and
           reset axes properties before each new plot command.
           (default).
 
      ‘hold’
           Toggle the current hold state.
 
      When given the additional argument HAX, the hold state is modified
      for this axes rather than the current axes returned by ‘gca’.
 
      To query the current hold state use the ‘ishold’ function.
 
DONTPRINTYET       See also: Seeishold XREFishold, Seecla XREFcla, *noteclf:
DONTPRINTYET       See also: Seeishold XREFishold, Seecla XREFcla, Seeclf

      XREFclf, Seenewplot XREFnewplot.
 
  -- : ishold
  -- : ishold (HAX)
  -- : ishold (HFIG)
      Return true if the next plot will be added to the current plot, or
      false if the plot device will be cleared before drawing the next
      plot.
 
      If the first argument is an axes handle HAX or figure handle HFIG
      then operate on this plot rather than the current one.
 
      See also: Seehold XREFhold, Seenewplot XREFnewplot.
 
    To clear the current figure, call the ‘clf’ function.  To clear the
 current axis, call the ‘cla’ function.  To bring the current figure to
 the top of the window stack, call the ‘shg’ function.  To delete a
 graphics object, call ‘delete’ on its index.  To close the figure
 window, call the ‘close’ function.
 
  -- : clf
  -- : clf reset
  -- : clf (HFIG)
  -- : clf (HFIG, "reset")
  -- : H = clf (...)
      Clear the current figure window.
 
      ‘clf’ operates by deleting child graphics objects with visible
      handles (HandleVisibility = "on").
 
      If the optional argument "reset" is specified, delete all child
      objects including those with hidden handles and reset all figure
      properties to their defaults.  However, the following properties
      are not reset: Position, Units, PaperPosition, PaperUnits.
 
      If the first argument HFIG is a figure handle, then operate on this
      figure rather than the current figure returned by ‘gcf’.
 
      The optional return value H is the graphics handle of the figure
      window that was cleared.
 
DONTPRINTYET       See also: Seecla XREFcla, Seeclose XREFclose, *notedelete:
DONTPRINTYET       See also: Seecla XREFcla, Seeclose XREFclose, Seedelete

      XREFdelete, Seereset XREFreset.
 
  -- : cla
  -- : cla reset
  -- : cla (HAX)
  -- : cla (HAX, "reset")
      Clear the current axes.
 
      ‘cla’ operates by deleting child graphic objects with visible
      handles (HandleVisibility = "on").
 
      If the optional argument "reset" is specified, delete all child
      objects including those with hidden handles and reset all axes
      properties to their defaults.  However, the following properties
      are not reset: Position, Units.
 
      If the first argument HAX is an axes handle, then operate on this
      axes rather than the current axes returned by ‘gca’.
 
DONTPRINTYET       See also: Seeclf XREFclf, Seedelete XREFdelete, *noteDONTPRINTYET       See also: Seeclf XREFclf, Seedelete XREFdelete, See
      reset XREFreset.
 
  -- : shg
      Show the graph window.
 
      Currently, this is the same as executing ‘drawnow’.
 
      See also: Seedrawnow XREFdrawnow, Seefigure XREFfigure.
 
  -- : delete (FILE)
  -- : delete (FILE1, FILE2, ...)
  -- : delete (HANDLE)
      Delete the named file or graphics handle.
 
      FILE may contain globbing patterns such as ‘*’.  Multiple files to
      be deleted may be specified in the same function call.
 
      HANDLE may be a scalar or vector of graphic handles to delete.
 
      Programming Note: Deleting graphics objects is the proper way to
      remove features from a plot without clearing the entire figure.
 
DONTPRINTYET       See also: Seeclf XREFclf, Seecla XREFcla, *noteunlink:
DONTPRINTYET       See also: Seeclf XREFclf, Seecla XREFcla, Seeunlink

      XREFunlink, Seermdir XREFrmdir.
 
  -- : close
  -- : close H
  -- : close (H)
  -- : close (H, "force")
  -- : close all
  -- : close all hidden
  -- : close all force
      Close figure window(s).
 
      When called with no arguments, close the current figure.  This is
      equivalent to ‘close (gcf)’.  If the input H is a graphic handle,
      or vector of graphics handles, then close each figure in H.
 
      If the argument "all" is given then all figures with visible
      handles (HandleVisibility = "on") are closed.
 
      If the argument "all hidden" is given then all figures, including
      hidden ones, are closed.
 
      If the argument "force" is given then figures are closed even when
      "closerequestfcn" has been altered to prevent closing the window.
 
      Implementation Note: ‘close’ operates by calling the function
      specified by the "closerequestfcn" property for each figure.  By
      default, the function ‘closereq’ is used.  It is possible that the
      function invoked will delay or abort removing the figure.  To
      remove a figure without executing any callback functions use
      ‘delete’.  When writing a callback function to close a window do
      not use ‘close’ to avoid recursion.
 
      See also: Seeclosereq XREFclosereq, Seedelete XREFdelete.
 
  -- : closereq ()
      Close the current figure and delete all graphics objects associated
      with it.
 
      By default, the "closerequestfcn" property of a new plot figure
      points to this function.
 
      See also: Seeclose XREFclose, Seedelete XREFdelete.