1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
<html lang="en">
<head>
<title>Introduction to Graphics Structures - GNU Octave</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Octave">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Graphics-Data-Structures.html#Graphics-Data-Structures" title="Graphics Data Structures">
<link rel="next" href="Graphics-Objects.html#Graphics-Objects" title="Graphics Objects">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Introduction-to-Graphics-Structures"></a>
<p>
Next: <a rel="next" accesskey="n" href="Graphics-Objects.html#Graphics-Objects">Graphics Objects</a>,
Up: <a rel="up" accesskey="u" href="Graphics-Data-Structures.html#Graphics-Data-Structures">Graphics Data Structures</a>
<hr>
</div>
<h4 class="subsection">15.3.1 Introduction to Graphics Structures</h4>
<p><a name="index-introduction-to-graphics-structures-1486"></a><a name="doc_002dgraphics-structures"></a>The graphics functions use pointers, which are of class graphics_handle, in
order to address the data structures which control graphical displays. A
graphics handle may point any one of a number of different object types. The
objects are the graphics data structures. The types of objects are:
<code>figure</code>, <code>axes</code>, <code>line</code>, <code>text</code>, <code>patch</code>,
<code>surface</code>, <code>text</code> and <code>image</code>.
<p>Each of these objects has a function by the same name. and, each of these
functions returns a graphics handle pointing to an object of corresponding
type. In addition there are several functions which operate on properties of
the graphics objects and which return handles: the functions <code> plot</code> and
<code>plot3</code> return a handle pointing to an object of type line, the function
<code>subplot</code> returns a handle pointing to an object of type axes, the
function <code>fill</code> returns a handle pointing to an object of type patch, the
functions <code>area</code>, <code>bar</code>, <code>barh</code>, <code>contour</code>,
<code>contourf</code>, <code>contour3</code>, <code>surf</code>, <code>mesh</code>, <code>surfc</code>,
<code>meshc</code>, <code>errorbar</code>, <code>quiver</code>, <code>quiver3</code>, <code>scatter</code>,
<code>scatter3</code>, <code>stair</code>, <code>stem</code>, <code>stem3</code> each return a handle
as documented in <a href="doc_002ddatasources.html#doc_002ddatasources">Data Sources</a>.
<p>The graphics objects are arranged in a hierarchy:
<p>1. The root is at 0. i.e., <code>get (0)</code> returns the properties of the root
object.
<p>2. Below the root are <code>figure</code> objects.
<p>3. Below the <code>figure</code> objects are <code>axes</code>.
<p>4. Below the <code>axes</code> objects are
<code>line</code>, <code>text</code>, <code>patch</code>,
<code>surface</code>, and <code>image</code> objects.
<p>Graphics handles may be distinguished from function handles (<a href="Function-Handles.html#Function-Handles">Function Handles</a>) by means of the function <code>ishandle</code>. <code>ishandle</code> returns
true if its argument is a handle of a graphics object. In addition, the figure
object may be tested using <code>isfigure</code>. <code>isfigure</code> returns true only
if its argument is a handle of a figure. ishghandle() is synonymous with
ishandle(). The <code>whos</code> function can be used to show the object type of
each currently defined graphics handle. (Note: this is not true today, but it
is, I hope, considered an error in whos. It may be better to have whos just
show graphics_handle as the class, and provide a new function which, given a
graphics handle, returns its object type. This could generalize the ishandle()
functions and, in fact, replace them.)
<p>The <code>get</code> and <code>set</code> commands are
used to obtain and set the values of properties of graphics objects. In
addition, the <code>get</code> command may be used to obtain property names.
<p>For example, the property "type" of the graphics object pointed to by the
graphics handle h may be displayed by:
<pre class="example"> get (h, "type")
</pre>
<p>The properties and their current values are returned by <code>get (h)</code>
where h is a handle of a graphics object. If only the names of the
allowed properties are wanted they may be displayed by:
<code>get (h, "")</code>.
<p>Thus, for example,
<pre class="smallexample"> h = figure ();
get (h, "type")
ans = figure
get (h, "");
error: get: ambiguous figure property name ; possible matches:
__graphics_toolkit__ hittest resize
__enhanced__ integerhandle resizefcn
__modified__ interruptible selected
__myhandle__ inverthardcopy selectionhighlight
__plot_stream__ keypressfcn selectiontype
alphamap keyreleasefcn tag
beingdeleted menubar toolbar
busyaction mincolormap type
buttondownfcn name uicontextmenu
children nextplot units
clipping numbertitle userdata
closerequestfcn paperorientation visible
color paperposition windowbuttondownfcn
colormap paperpositionmode windowbuttonmotionfcn
createfcn papersize windowbuttonupfcn
currentaxes papertype windowbuttonwheelfcn
currentcharacter paperunits windowstyle
currentobject parent wvisual
currentpoint pointer wvisualmode
deletefcn pointershapecdata xdisplay
dockcontrols pointershapehotspot xvisual
doublebuffer position xvisualmode
filename renderer
handlevisibility renderermode
</pre>
<p>The root figure has index 0. Its properties may be displayed by:
<code>get (0, "")</code>.
<p>The uses of <code>get</code> and <code>set</code> are further explained in
<a href="doc_002dget.html#doc_002dget">get</a>, <a href="doc_002dset.html#doc_002dset">set</a>.
<!-- isprop scripts/plot/isprop.m -->
<p><a name="doc_002disprop"></a>
<div class="defun">
— Function File: <var>res</var> = <b>isprop</b> (<var>h, prop</var>)<var><a name="index-isprop-1487"></a></var><br>
<blockquote><p>Return true if <var>prop</var> is a property of the object with handle <var>h</var>.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dget.html#doc_002dget">get</a>, <a href="doc_002dset.html#doc_002dset">set</a>.
</p></blockquote></div>
</body></html>
|