octave: Plot Annotations

 
 15.2.3 Plot Annotations
 -----------------------
 
 You can add titles, axis labels, legends, and arbitrary text to an
 existing plot.  For example:
 
      x = -10:0.1:10;
      plot (x, sin (x));
      title ("sin(x) for x = -10:0.1:10");
      xlabel ("x");
      ylabel ("sin (x)");
      text (pi, 0.7, "arbitrary text");
      legend ("sin (x)");
 
    The functions ‘grid’ and ‘box’ may also be used to add grid and
 border lines to the plot.  By default, the grid is off and the border
 lines are on.
 
    Finally, arrows, text and rectangular or elliptic boxes can be added
 to highlight parts of a plot using the ‘annotation’ function.  Those
 objects are drawn in an invisible axes, on top of every other axes.
 
  -- : title (STRING)
  -- : title (STRING, PROP, VAL, ...)
  -- : title (HAX, ...)
  -- : H = title (...)
      Specify the string used as a title for the current axis.
 
      An optional list of PROPERTY/VALUE pairs can be used to change the
      appearance of the created title text object.
 
      If the first argument HAX is an axes handle, then plot into this
      axes, rather than the current axes returned by ‘gca’.
 
      The optional return value H is a graphics handle to the created
      text object.
 
DONTPRINTYET       See also: Seexlabel XREFxlabel, Seeylabel XREFylabel, *noteDONTPRINTYET       See also: Seexlabel XREFxlabel, Seeylabel XREFylabel, See
      zlabel XREFzlabel, Seetext XREFtext.
 
  -- : legend (STR1, STR2, ...)
  -- : legend (MATSTR)
  -- : legend (CELLSTR)
  -- : legend (..., "location", POS)
  -- : legend (..., "orientation", ORIENT)
  -- : legend (HAX, ...)
  -- : legend (HOBJS, ...)
  -- : legend (HAX, HOBJS, ...)
  -- : legend ("OPTION")
  -- : [HLEG, HLEG_OBJ, HPLOT, LABELS] = legend (...)
 
      Display a legend for the current axes using the specified strings
      as labels.
 
      Legend entries may be specified as individual character string
      arguments, a character array, or a cell array of character strings.
 
      If the first argument HAX is an axes handle, then plot into this
      axes, rather than the current axes returned by ‘gca’.  If the
      handles, HOBJS, are not specified then the legend’s strings will be
      associated with the axes’ descendants.  ‘legend’ works on line
      graphs, bar graphs, etc.  A plot must exist before legend is
      called.
 
      The optional parameter POS specifies the location of the legend as
      follows:
 
           pos        location of the legend
      ---------------------------------------------------------------------------
           north      center top
           south      center bottom
           east       right center
           west       left center
           northeast  right top (default)
           northwest  left top
           southeast  right bottom
           southwest  left bottom
           outside    can be appended to any location string
 
      The optional parameter ORIENT determines if the key elements are
      placed vertically or horizontally.  The allowed values are
      "vertical" (default) or "horizontal".
 
      The following customizations are available using OPTION:
 
      "show"
           Show legend on the plot
 
      "hide"
           Hide legend on the plot
 
      "toggle"
           Toggles between "hide" and "show"
 
      "boxon"
           Show a box around legend (default)
 
      "boxoff"
           Hide the box around legend
 
      "right"
           Place label text to the right of the keys (default)
 
      "left"
           Place label text to the left of the keys
 
      "off"
           Delete the legend object
 
      The optional output values are
 
      HLEG
           The graphics handle of the legend object.
 
      HLEG_OBJ
           Graphics handles to the text and line objects which make up
           the legend.
 
      HPLOT
           Graphics handles to the plot objects which were used in making
           the legend.
 
      LABELS
           A cell array of strings of the labels in the legend.
 
      The legend label text is either provided in the call to ‘legend’ or
      is taken from the DisplayName property of graphics objects.  If no
      labels or DisplayNames are available, then the label text is simply
      "data1", "data2", ..., "dataN".
 
      Implementation Note: A legend is implemented as an additional axes
      object of the current figure with the "tag" set to "legend".
      Properties of the legend object may be manipulated directly by
      using ‘set’.
 
  -- : text (X, Y, STRING)
  -- : text (X, Y, Z, STRING)
  -- : text (..., PROP, VAL, ...)
  -- : H = text (...)
      Create a text object with text STRING at position X, Y, (Z) on the
      current axes.
 
      Multiple locations can be specified if X, Y, (Z) are vectors.
      Multiple strings can be specified with a character matrix or a cell
      array of strings.
 
      Optional property/value pairs may be used to control the appearance
      of the text.
 
      The optional return value H is a vector of graphics handles to the
      created text objects.
 
DONTPRINTYET       See also: Seegtext XREFgtext, Seetitle XREFtitle, *noteDONTPRINTYET DONTPRINTYET       See also: Seegtext XREFgtext, Seetitle XREFtitle, See
      xlabel XREFxlabel, Seeylabel XREFylabel, *notezlabel:
DONTPRINTYET DONTPRINTYET       See also: Seegtext XREFgtext, Seetitle XREFtitle, See
      xlabel XREFxlabel, Seeylabel XREFylabel, Seezlabel

      XREFzlabel.
 
    See SeeText Properties for the properties that you can set.
 
  -- : xlabel (STRING)
  -- : xlabel (STRING, PROPERTY, VAL, ...)
  -- : xlabel (HAX, ...)
  -- : H = xlabel (...)
      Specify the string used to label the x-axis of the current axis.
 
      An optional list of PROPERTY/VALUE pairs can be used to change the
      properties of the created text label.
 
      If the first argument HAX is an axes handle, then operate on this
      axes rather than the current axes returned by ‘gca’.
 
      The optional return value H is a graphics handle to the created
      text object.
 
DONTPRINTYET       See also: Seeylabel XREFylabel, Seezlabel XREFzlabel, *noteDONTPRINTYET DONTPRINTYET       See also: Seeylabel XREFylabel, Seezlabel XREFzlabel, See
      datetick XREFdatetick, Seetitle XREFtitle, *notetext:
DONTPRINTYET DONTPRINTYET       See also: Seeylabel XREFylabel, Seezlabel XREFzlabel, See
      datetick XREFdatetick, Seetitle XREFtitle, Seetext

      XREFtext.
 
  -- : clabel (C, H)
  -- : clabel (C, H, V)
  -- : clabel (C, H, "manual")
  -- : clabel (C)
  -- : clabel (..., PROP, VAL, ...)
  -- : H = clabel (...)
      Add labels to the contours of a contour plot.
 
      The contour levels are specified by the contour matrix C which is
      returned by ‘contour’, ‘contourc’, ‘contourf’, and ‘contour3’.
      Contour labels are rotated to match the local line orientation and
      centered on the line.  The position of labels along the contour
      line is chosen randomly.
 
      If the argument H is a handle to a contour group object, then label
      this plot rather than the one in the current axes returned by
      ‘gca’.
 
      By default, all contours are labeled.  However, the contours to
      label can be specified by the vector V.  If the "manual" argument
      is given then the contours to label can be selected with the mouse.
 
      Additional property/value pairs that are valid properties of text
      objects can be given and are passed to the underlying text objects.
      Moreover, the contour group property "LabelSpacing" is available
      which determines the spacing between labels on a contour to be
      specified.  The default is 144 points, or 2 inches.
 
      The optional return value H is a vector of graphics handles to the
      text objects representing each label.  The "userdata" property of
      the text objects contains the numerical value of the contour label.
 
      An example of the use of ‘clabel’ is
 
           [c, h] = contour (peaks (), -4 : 6);
           clabel (c, h, -4:2:6, "fontsize", 12);
 
      See also: Seecontour XREFcontour, Seecontourf XREFcontourf,
DONTPRINTYET       Seecontour3 XREFcontour3, Seemeshc XREFmeshc, *notesurfc:
DONTPRINTYET       Seecontour3 XREFcontour3, Seemeshc XREFmeshc, Seesurfc

      XREFsurfc, Seetext XREFtext.
 
  -- : box
  -- : box on
  -- : box off
  -- : box (HAX, ...)
      Control display of the axes border.
 
      The argument may be either "on" or "off".  If it is omitted, the
      current box state is toggled.
 
      If the first argument HAX is an axes handle, then operate on this
      axes rather than the current axes returned by ‘gca’.
 
      See also: Seeaxis XREFaxis, Seegrid XREFgrid.
 
  -- : grid
  -- : grid on
  -- : grid off
  -- : grid minor
  -- : grid minor on
  -- : grid minor off
  -- : grid (HAX, ...)
      Control the display of plot grid lines.
 
      The function state input may be either "on" or "off".  If it is
      omitted, the current grid state is toggled.
 
      When the first argument is "minor" all subsequent commands modify
      the minor grid rather than the major grid.
 
      If the first argument HAX is an axes handle, then operate on this
      axes rather than the current axes returned by ‘gca’.
 
      To control the grid lines for an individual axes use the ‘set’
      function.  For example:
 
           set (gca, "ygrid", "on");
 
      See also: Seeaxis XREFaxis, Seebox XREFbox.
 
  -- : colorbar
  -- : colorbar (LOC)
  -- : colorbar (DELETE_OPTION)
  -- : colorbar (HCB, ...)
  -- : colorbar (HAX, ...)
  -- : colorbar (..., "peer", HAX, ...)
  -- : colorbar (..., "location", LOC, ...)
  -- : colorbar (..., PROP, VAL, ...)
  -- : H = colorbar (...)
      Add a colorbar to the current axes.
 
      A colorbar displays the current colormap along with numerical
      rulings so that the color scale can be interpreted.
 
      The optional input LOC determines the location of the colorbar.
      Valid values for LOC are
 
      "EastOutside"
           Place the colorbar outside the plot to the right.  This is the
           default.
 
      "East"
           Place the colorbar inside the plot to the right.
 
      "WestOutside"
           Place the colorbar outside the plot to the left.
 
      "West"
           Place the colorbar inside the plot to the left.
 
      "NorthOutside"
           Place the colorbar above the plot.
 
      "North"
           Place the colorbar at the top of the plot.
 
      "SouthOutside"
           Place the colorbar under the plot.
 
      "South"
           Place the colorbar at the bottom of the plot.
 
      To remove a colorbar from a plot use any one of the following
      keywords for the DELETE_OPTION: "delete", "hide", "off".
 
      If the argument "peer" is given, then the following argument is
      treated as the axes handle in which to add the colorbar.
      Alternatively, If the first argument HAX is an axes handle, then
      the colorbar is added to this axes, rather than the current axes
      returned by ‘gca’.
 
      If the first argument HCB is a handle to a colorbar object, then
      operate on this colorbar directly.
 
      Additional property/value pairs are passed directly to the
      underlying axes object.
 
      The optional return value H is a graphics handle to the created
      colorbar object.
 
      Implementation Note: A colorbar is created as an additional axes to
      the current figure with the "tag" property set to "colorbar".  The
      created axes object has the extra property "location" which
      controls the positioning of the colorbar.
 
      See also: Seecolormap XREFcolormap.
 
  -- : annotation (TYPE)
  -- : annotation ("line", X, Y)
  -- : annotation ("arrow", X, Y)
  -- : annotation ("doublearrow", X, Y)
  -- : annotation ("textarrow", X, Y)
  -- : annotation ("textbox", POS)
  -- : annotation ("rectangle", POS)
  -- : annotation ("ellipse", POS)
  -- : annotation (..., PROP, VAL)
  -- : annotation (HF, ...)
  -- : H = annotation (...)
      Draw annotations to emphasize parts of a figure.
 
      You may build a default annotation by specifying only the TYPE of
      the annotation.
 
      Otherwise you can select the type of annotation and then set its
      position using either X and Y coordinates for line-based
      annotations or a position vector POS for others.  In either case,
      coordinates are interpreted using the "units" property of the
      annotation object.  The default is "normalized", which means the
      lower left hand corner of the figure has coordinates ‘[0 0]’ and
      the upper right hand corner ‘[1 1]’.
 
      If the first argument HF is a figure handle, then plot into this
      figure, rather than the current figure returned by ‘gcf’.
 
      Further arguments can be provided in the form of PROP/VAL pairs to
      customize the annotation appearance.
 
      The optional return value H is a graphics handle to the created
      annotation object.  This can be used with the ‘set’ function to
      customize an existing annotation object.
 
      All annotation objects share two properties:
 
         • "units": the units in which coordinates are interpreted.
           Its value may be one of "centimeters" | "characters" |
           "inches" | "{normalized}" | "pixels" | "points".
 
         • "position": a four-element vector [x0 y0 width height].
           The vector specifies the coordinates (x0,y0) of the origin of
           the annotation object, its width, and its height.  The width
           and height may be negative, depending on the orientation of
           the object.
 
      Valid annotation types and their specific properties are described
      below:
 
      "line"
           Constructs a line.  X and Y must be two-element vectors
           specifying the x and y coordinates of the two ends of the
           line.
 
           The line can be customized using "linewidth", "linestyle", and
           "color" properties the same way as for ‘line’ objects.
 
      "arrow"
           Construct an arrow.  The second point in vectors X and Y
           specifies the arrowhead coordinates.
 
           Besides line properties, the arrowhead can be customized using
           "headlength", "headwidth", and "headstyle" properties.
           Supported values for "headstyle" property are: ["diamond" |
           "ellipse" | "plain" | "rectangle" | "vback1" | "{vback2}" |
           "vback3"]
 
      "doublearrow"
           Construct a double arrow.  Vectors X and Y specify the
           arrowhead coordinates.
 
           The line and the arrowhead can be customized as for arrow
           annotations, but some property names are duplicated:
           "head1length"/"head2length", "head1width"/"head2width", etc.
           The index 1 marks the properties of the arrowhead at the first
           point in X and Y coordinates.
 
      "textarrow"
           Construct an arrow with a text label at the opposite end from
           the arrowhead.
 
           Use the "string" property to change the text string.  The line
           and the arrowhead can be customized as for arrow annotations,
           and the text can be customized using the same properties as
           ‘text’ graphics objects.  Note, however, that some text
           property names are prefixed with "text" to distinguish them
           from arrow properties: "textbackgroundcolor", "textcolor",
           "textedgecolor", "textlinewidth", "textmargin",
           "textrotation".
 
      "textbox"
           Construct a box with text inside.  POS specifies the
           "position" property of the annotation.
 
           Use the "string" property to change the text string.  You may
           use "backgroundcolor", "edgecolor", "linestyle", and
           "linewidth" properties to customize the box background color
           and edge appearance.  A limited set of ‘text’ objects
           properties are also available; Besides "font..." properties,
           you may also use "horizontalalignment" and "verticalalignment"
           to position the text inside the box.
 
           Finally, the "fitboxtotext" property controls the actual
           extent of the box.  If "on" (the default) the box limits are
           fitted to the text extent.
 
      "rectangle"
           Construct a rectangle.  POS specifies the "position" property
           of the annotation.
 
           You may use "facecolor", "color", "linestyle", and "linewidth"
           properties to customize the rectangle background color and
           edge appearance.
 
      "ellipse"
           Construct an ellipse.  POS specifies the "position" property
           of the annotation.
 
           See "rectangle" annotations for customization.
 
DONTPRINTYET       See also: Seexlabel XREFxlabel, Seeylabel XREFylabel, *noteDONTPRINTYET       See also: Seexlabel XREFxlabel, Seeylabel XREFylabel, See
      zlabel XREFzlabel, Seetitle XREFtitle, Seetext XREFtext,
DONTPRINTYET       Seegtext XREFgtext, Seelegend XREFlegend, *notecolorbar:
DONTPRINTYET       Seegtext XREFgtext, Seelegend XREFlegend, Seecolorbar

      XREFcolorbar.