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 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
|
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Introduction to Graphics Structures (GNU Octave (version 10.3.0))</title>
<meta name="description" content="Introduction to Graphics Structures (GNU Octave (version 10.3.0))">
<meta name="keywords" content="Introduction to Graphics Structures (GNU Octave (version 10.3.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Graphics-Data-Structures.html" rel="up" title="Graphics Data Structures">
<link href="Graphics-Objects.html" rel="next" title="Graphics Objects">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
div.example {margin-left: 3.2em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">
</head>
<body lang="en">
<div class="subsection-level-extent" id="Introduction-to-Graphics-Structures">
<div class="nav-panel">
<p>
Next: <a href="Graphics-Objects.html" accesskey="n" rel="next">Graphics Objects</a>, Up: <a href="Graphics-Data-Structures.html" accesskey="u" rel="up">Graphics Data Structures</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsection" id="Introduction-to-Graphics-Structures-1"><span>15.3.1 Introduction to Graphics Structures<a class="copiable-link" href="#Introduction-to-Graphics-Structures-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-introduction-to-graphics-structures"></a>
<p>The graphics functions use pointers, which are of class graphics_handle, in
order to address the data structures which control visual display. A
graphics handle may point to any one of a number of different base object
types. These objects are the graphics data structures themselves. The
primitive graphic object types are: <code class="code">figure</code>, <code class="code">axes</code>, <code class="code">line</code>,
<code class="code">text</code>, <code class="code">patch</code>, <code class="code">scatter</code>, <code class="code">surface</code>, <code class="code">text</code>,
<code class="code">image</code>, and <code class="code">light</code>.
</p>
<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 the corresponding
type.
</p>
<p>In addition, there are several functions which operate on properties of the
graphics objects and which also return handles. This includes but is not
limited to the following functions: The functions <code class="code">plot</code> and <code class="code">plot3</code>
return a handle pointing to an object of type <code class="code">line</code>. The function
<code class="code">subplot</code> returns a handle pointing to an object of type <code class="code">axes</code>.
The functions <code class="code">fill</code>, <code class="code">fill3</code>, <code class="code">trimesh</code>, and <code class="code">trisurf</code>
return a handle pointing to an object of type patch. The function
<code class="code">scatter3</code> returns a handle to an object of type scatter. The functions
<code class="code">slice</code>, <code class="code">surf</code>, <code class="code">surfl</code>, <code class="code">mesh</code>, <code class="code">meshz</code>,
<code class="code">pcolor</code>, and <code class="code">waterfall</code> each return a handle of type surface. The
function <code class="code">camlight</code> returns a handle to an object of type light. The
functions <code class="code">area</code>, <code class="code">bar</code>, <code class="code">barh</code>, <code class="code">contour</code>,
<code class="code">contourf</code>, <code class="code">contour3</code>, <code class="code">surfc</code>, <code class="code">meshc</code>, <code class="code">errorbar</code>,
<code class="code">quiver</code>, <code class="code">quiver3</code>, <code class="code">stair</code>, <code class="code">stem</code>, <code class="code">stem3</code> each
return a handle to a complex data structure as documented in
<a class="ref" href="Data-Sources-in-Object-Groups.html">Data Sources</a>.
</p>
<p>The graphics objects are arranged in a hierarchy:
</p>
<p>1. The root object is returned by <code class="code">groot</code> (historically, equivalent to
the handle 0). In other words, <code class="code">get (groot)</code> returns the properties of
the root object.
</p>
<p>2. Below the root are <code class="code">figure</code> objects.
</p>
<p>3. Below the <code class="code">figure</code> objects are <code class="code">axes</code> or <code class="code">hggroup</code> objects.
</p>
<p>4. Below the <code class="code">axes</code> or <code class="code">hggroup</code> objects are <code class="code">line</code>,
<code class="code">text</code>, <code class="code">patch</code>, <code class="code">scatter</code>, <code class="code">surface</code>, <code class="code">image</code>, and
<code class="code">light</code> objects.
</p>
<p>It is possible to walk this hierarchical tree by querying the <code class="code">"parent"</code>
and <code class="code">"children"</code> properties of the graphics objects.
</p>
<p>Graphics handles may be distinguished from function handles
(see <a class="pxref" href="Function-Handles.html">Function Handles</a>) by means of the function <code class="code">ishghandle</code>.
<code class="code">ishghandle</code> returns true if its argument is a handle of a graphics
object. In addition, a figure or axes object may be tested using
<code class="code">isfigure</code> or <code class="code">isaxes</code> respectively. To test for a specific type of
graphics handle, such as a patch or line object, use <code class="code">isgraphics</code>. The
more specific test functions return true only if the argument is both a
graphics handle and of the correct type (figure, axes, specified object type).
</p>
<p>The <code class="code">get</code> and <code class="code">set</code> commands are used to obtain and set the values of
properties of graphics objects. In addition, the <code class="code">get</code> command may be
used to obtain property names.
</p>
<p>For example, the property <code class="code">"type"</code> of the graphics object pointed to by
the graphics handle h may be displayed by:
</p>
<div class="example">
<pre class="example-preformatted">get (h, "type")
</pre></div>
<p>The properties and their current values may be obtained in the form of a
structure using <code class="code">s = get (h)</code>, where <code class="code">h</code> is the handle of a graphics
object. If only the names of the properties and the allowed values (for radio
properties only) are wanted, one may use <code class="code">set (h)</code>.
</p>
<p>Thus, for example:
</p>
<div class="example">
<pre class="example-preformatted">h = figure ();
get (h, "type")
⇒ ans = figure
set (h)
⇒
alphamap:
beingdeleted: [ {off} | on ]
busyaction: [ cancel | {queue} ]
buttondownfcn:
clipping: [ off | {on} ]
closerequestfcn:
color:
colormap:
createfcn:
currentaxes:
deletefcn:
dockcontrols: [ {off} | on ]
filename:
graphicssmoothing: [ off | {on} ]
handlevisibility: [ callback | off | {on} ]
...
</pre></div>
<p>The uses of <code class="code">get</code> and <code class="code">set</code> are further explained in
<a class="ref" href="Handle-Functions.html#XREFget">get</a>, <a class="ref" href="Handle-Functions.html#XREFset">set</a>.
</p>
<a class="anchor" id="XREFisprop"></a><span style="display:block; margin-top:-4.5ex;"> </span>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-isprop"><span><code class="def-type"><var class="var">res</var> =</code> <strong class="def-name">isprop</strong> <code class="def-code-arguments">(<var class="var">obj</var>, "<var class="var">prop</var>")</code><a class="copiable-link" href="#index-isprop"> ¶</a></span></dt>
<dd><p>Return true if <var class="var">prop</var> is a property of the object <var class="var">obj</var>.
</p>
<p><var class="var">obj</var> may also be an array of objects in which case <var class="var">res</var> will be a
logical array indicating whether each handle has the property <var class="var">prop</var>.
</p>
<p>For plotting, <var class="var">obj</var> is a handle to a graphics object. Otherwise,
<var class="var">obj</var> should be an instance of a class. <code class="code">isprop</code> reports whether
the class defines a property, but <code class="code">Access</code> permissions or visibility
restrictions (<code class="code">Hidden = true</code>) may prevent use by the programmer.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="Handle-Functions.html#XREFget">get</a>, <a class="ref" href="Handle-Functions.html#XREFset">set</a>, <a class="ref" href="Properties.html#XREFproperties">properties</a>, <a class="ref" href="Creating-a-Class.html#XREFismethod">ismethod</a>, <a class="ref" href="Creating-a-Class.html#XREFisobject">isobject</a>.
</p></dd></dl>
</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Graphics-Objects.html">Graphics Objects</a>, Up: <a href="Graphics-Data-Structures.html">Graphics Data Structures</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|