File: Creating-Graphics-Objects.html

package info (click to toggle)
octave 10.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 145,388 kB
  • sloc: cpp: 335,976; ansic: 82,241; fortran: 20,963; objc: 9,402; sh: 8,756; yacc: 4,392; lex: 4,333; perl: 1,544; java: 1,366; awk: 1,259; makefile: 659; xml: 192
file content (312 lines) | stat: -rw-r--r-- 25,287 bytes parent folder | download | duplicates (2)
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<!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>Creating Graphics Objects (GNU Octave (version 10.3.0))</title>

<meta name="description" content="Creating Graphics Objects (GNU Octave (version 10.3.0))">
<meta name="keywords" content="Creating Graphics Objects (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-Objects.html" rel="up" title="Graphics Objects">
<link href="Handle-Functions.html" rel="next" title="Handle Functions">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
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="subsubsection-level-extent" id="Creating-Graphics-Objects">
<div class="nav-panel">
<p>
Next: <a href="Handle-Functions.html" accesskey="n" rel="next">Handle Functions</a>, Up: <a href="Graphics-Objects.html" accesskey="u" rel="up">Graphics Objects</a> &nbsp; [<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="subsubsection" id="Creating-Graphics-Objects-1"><span>15.3.2.1 Creating Graphics Objects<a class="copiable-link" href="#Creating-Graphics-Objects-1"> &para;</a></span></h4>
<a class="index-entry-id" id="index-creating-graphics-objects"></a>

<p>You can create any graphics object primitive by calling the function of the
same name as the object; In other words, <code class="code">figure</code>, <code class="code">axes</code>,
<code class="code">line</code>, <code class="code">text</code>, <code class="code">image</code>, <code class="code">patch</code>, <code class="code">surface</code>, and
<code class="code">light</code> functions.  These fundamental graphic objects automatically become
children of the current axes object as if <code class="code">hold on</code> was in place.
Separately, axes will automatically become children of the current figure
object and figures will become children of the root object.
</p>
<p>If this auto-joining feature is not desired then it is important to call
<code class="code">newplot</code> first to prepare a new figure and axes for plotting.
Alternatively, the easier way is to call a high-level graphics routine which
will both create the plot and then populate it with low-level graphics objects.
Instead of calling <code class="code">line</code>, use <code class="code">plot</code>.  Or use <code class="code">surf</code> instead of
<code class="code">surface</code>.  Or use <code class="code">fill</code> or <code class="code">fill3</code> instead of <code class="code">patch</code>.
</p>
<a class="anchor" id="XREFaxes"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-axes"><span><strong class="def-name">axes</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-axes"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-axes-1"><span><strong class="def-name">axes</strong> <code class="def-code-arguments">(<var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-axes-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-axes-2"><span><strong class="def-name">axes</strong> <code class="def-code-arguments">(<var class="var">hpar</var>, <var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-axes-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-axes-3"><span><strong class="def-name">axes</strong> <code class="def-code-arguments">(<var class="var">hax</var>)</code><a class="copiable-link" href="#index-axes-3"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-axes-4"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">axes</strong> <code class="def-code-arguments">(&hellip;)</code><a class="copiable-link" href="#index-axes-4"> &para;</a></span></dt>
<dd><p>Create a Cartesian axes object and return a handle to it, or set the current
axes to <var class="var">hax</var>.
</p>
<p>Called without any arguments, or with <var class="var">property</var>/<var class="var">value</var> pairs,
construct a new axes.  The optional argument <var class="var">hpar</var> is a graphics handle
specifying the parent for the new axes and may be a figure, uipanel, or
uitab.
</p>
<p>Called with a single axes handle argument <var class="var">hax</var>, the function makes
<var class="var">hax</var> the current axes (as returned by <code class="code">gca</code>).  It also makes
the figure which contains <var class="var">hax</var> the current figure (as returned by
<code class="code">gcf</code>).  Finally, it restacks the parent object&rsquo;s <code class="code">children</code>
property so that the axes <var class="var">hax</var> appears before all other axes handles
in the list.  This causes <var class="var">hax</var> to be displayed on top of any other axes
objects (Z-order stacking).  In addition it restacks any legend or colorbar
objects associated with <var class="var">hax</var> so that they are also visible.
</p>
<p>Programming Note: The full list of properties is documented at
<a class="ref" href="Axes-Properties.html">Axes Properties</a>.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="Handle-Functions.html#XREFgca">gca</a>, <a class="ref" href="Handle-Functions.html#XREFset">set</a>, <a class="ref" href="Handle-Functions.html#XREFget">get</a>.
</p></dd></dl>


<a class="anchor" id="XREFline"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-line"><span><strong class="def-name">line</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-line"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-line-1"><span><strong class="def-name">line</strong> <code class="def-code-arguments">(<var class="var">x</var>, <var class="var">y</var>)</code><a class="copiable-link" href="#index-line-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-line-2"><span><strong class="def-name">line</strong> <code class="def-code-arguments">(<var class="var">x</var>, <var class="var">y</var>, <var class="var">z</var>)</code><a class="copiable-link" href="#index-line-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-line-3"><span><strong class="def-name">line</strong> <code class="def-code-arguments">(&quot;xdata&quot;, <var class="var">x</var>, &quot;ydata&quot;, <var class="var">y</var>)</code><a class="copiable-link" href="#index-line-3"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-line-4"><span><strong class="def-name">line</strong> <code class="def-code-arguments">(&quot;xdata&quot;, <var class="var">x</var>, &quot;ydata&quot;, <var class="var">y</var>, &quot;zdata&quot;, <var class="var">z</var>)</code><a class="copiable-link" href="#index-line-4"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-line-5"><span><strong class="def-name">line</strong> <code class="def-code-arguments">(&hellip;, <var class="var">property</var>, <var class="var">value</var>)</code><a class="copiable-link" href="#index-line-5"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-line-6"><span><strong class="def-name">line</strong> <code class="def-code-arguments">(<var class="var">hax</var>, &hellip;)</code><a class="copiable-link" href="#index-line-6"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-line-7"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">line</strong> <code class="def-code-arguments">(&hellip;)</code><a class="copiable-link" href="#index-line-7"> &para;</a></span></dt>
<dd><p>Create a line object from <var class="var">x</var> and <var class="var">y</var> (and possibly <var class="var">z</var>) and
insert it in the current axes.
</p>
<p>In the standard calling form the data <var class="var">x</var>, <var class="var">y</var>, and <var class="var">z</var> may be
scalars, vectors, or matrices.  In the case of matrix inputs, <code class="code">line</code>
will attempt to orient scalars and vectors so the results can be plotted.
This requires that one of the dimensions of the vector match either the
number of rows or the number of columns of the matrix.
</p>
<p>In the low-level calling form (50% higher performance) where the data is
specified by name (<code class="code">line (&quot;xdata&quot;, <var class="var">x</var>, &hellip;)</code>) the data must be
vectors.  If no data is specified (<code class="code">line ()</code>) then
<code class="code"><var class="var">x</var>&nbsp;==&nbsp;<var class="var">y</var>&nbsp;=&nbsp;[0,&nbsp;1]</code><!-- /@w -->.
</p>
<p>Multiple property-value pairs may be specified for the line object, but they
must appear in pairs.
</p>
<p>If called with only <var class="var">property</var>/<var class="var">value</var> pairs then any unspecified
properties use their default values as specified on the root object.
</p>
<p>If the first argument <var class="var">hax</var> is an axes handle, then plot into this axes,
rather than the current axes returned by <code class="code">gca</code>.
</p>
<p>The optional return value <var class="var">h</var> is a graphics handle (or vector of
handles) to the line objects created.
</p>
<p>Programming Note: The full list of properties is documented at
<a class="ref" href="Line-Properties.html">Line Properties</a>.
</p>
<p>The function <code class="code">line</code> differs from <code class="code">plot</code> in that line objects are
inserted in to the current axes without first clearing the plot.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="Displaying-Images.html#XREFimage">image</a>, <a class="ref" href="#XREFpatch">patch</a>, <a class="ref" href="Two_002ddimensional-Geometric-Shapes.html#XREFrectangle">rectangle</a>, <a class="ref" href="#XREFsurface">surface</a>, <a class="ref" href="Plot-Annotations.html#XREFtext">text</a>.
</p></dd></dl>


<a class="anchor" id="XREFpatch"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-patch"><span><strong class="def-name">patch</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-patch"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-patch-1"><span><strong class="def-name">patch</strong> <code class="def-code-arguments">(<var class="var">x</var>, <var class="var">y</var>, <var class="var">c</var>)</code><a class="copiable-link" href="#index-patch-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-patch-2"><span><strong class="def-name">patch</strong> <code class="def-code-arguments">(<var class="var">x</var>, <var class="var">y</var>, <var class="var">z</var>, <var class="var">c</var>)</code><a class="copiable-link" href="#index-patch-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-patch-3"><span><strong class="def-name">patch</strong> <code class="def-code-arguments">(&quot;Faces&quot;, <var class="var">faces</var>, &quot;Vertices&quot;, <var class="var">verts</var>, &hellip;)</code><a class="copiable-link" href="#index-patch-3"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-patch-4"><span><strong class="def-name">patch</strong> <code class="def-code-arguments">(&hellip;, &quot;<var class="var">prop</var>&quot;, <var class="var">val</var>, &hellip;)</code><a class="copiable-link" href="#index-patch-4"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-patch-5"><span><strong class="def-name">patch</strong> <code class="def-code-arguments">(&hellip;, <var class="var">propstruct</var>, &hellip;)</code><a class="copiable-link" href="#index-patch-5"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-patch-6"><span><strong class="def-name">patch</strong> <code class="def-code-arguments">(<var class="var">hax</var>, &hellip;)</code><a class="copiable-link" href="#index-patch-6"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-patch-7"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">patch</strong> <code class="def-code-arguments">(&hellip;)</code><a class="copiable-link" href="#index-patch-7"> &para;</a></span></dt>
<dd><p>Create patch object in the current axes with vertices at locations
(<var class="var">x</var>, <var class="var">y</var>) and of color <var class="var">c</var>.
</p>
<p>If the vertices are matrices of size MxN then each polygon patch
has M vertices and a total of N polygons will be created.  If some polygons
do not have M vertices use NaN to represent &quot;no vertex&quot;.  If the <var class="var">z</var>
input is present then 3-D patches will be created.
</p>
<p>The color argument <var class="var">c</var> can take many forms.  To create polygons
which all share a single color use a string value (e.g., <code class="code">&quot;r&quot;</code> for
red), a scalar value which is scaled by <code class="code">clim</code> and indexed into the
current colormap, or a 3-element RGB vector with the precise TrueColor.
</p>
<p>If <var class="var">c</var> is a vector of length N then the ith polygon will have a color
determined by scaling entry <var class="var">c</var>(i) according to <code class="code">clim</code> and then
indexing into the current colormap.  More complicated coloring situations
require directly manipulating patch property/value pairs.
</p>
<p>Instead of specifying polygons by matrices <var class="var">x</var> and <var class="var">y</var>, it is
possible to present a unique list of vertices and then a list of polygon
faces created from those vertices.  In this case the
<code class="code">&quot;Vertices&quot;</code> matrix will be an Nx2 (2-D patch) or
Nx3 (3-D patch).  The MxN <code class="code">&quot;Faces&quot;</code> matrix
describes M polygons having N vertices&mdash;each row describes a
single polygon and each column entry is an index into the
<code class="code">&quot;Vertices&quot;</code> matrix to identify a vertex.  The patch object
can be created by directly passing the property/value pairs
<code class="code">&quot;Vertices&quot;</code>/<var class="var">verts</var>, <code class="code">&quot;Faces&quot;</code>/<var class="var">faces</var> as
inputs.
</p>
<p>Instead of using property/value pairs, any property can be set by passing a
structure <var class="var">propstruct</var> with the respective field names.
</p>
<p>If the first argument <var class="var">hax</var> is an axes handle, then plot into this axes,
rather than the current axes returned by <code class="code">gca</code>.
</p>
<p>The optional return value <var class="var">h</var> is a graphics handle to the created patch
object.
</p>
<p>Programming Notes:
</p><ol class="enumerate">
<li> The full list of properties is documented at <a class="ref" href="Patch-Properties.html">Patch Properties</a>.
Useful patch properties include: <code class="code">&quot;edgecolor&quot;</code>, <code class="code">&quot;facecolor&quot;</code>,
<code class="code">&quot;faces&quot;</code>, <code class="code">&quot;vertices&quot;</code>, and <code class="code">&quot;facevertexcdata&quot;</code>.

</li><li> Unexpected geometry results can occur from mixing x-y-z and
face-vertex forms of defining geometry.

</li><li> Unexpected patch color results can occur from using <code class="code">&quot;cdata&quot;</code> color
definitions with face-vertex defined geometry or <code class="code">&quot;facevertexcdata&quot;</code>
color definitions with x-y-z defined geometry.
</li></ol>

<p><strong class="strong">See also:</strong> <a class="ref" href="Two_002dDimensional-Plots.html#XREFfill">fill</a>, <a class="ref" href="Handle-Functions.html#XREFget">get</a>, <a class="ref" href="Handle-Functions.html#XREFset">set</a>.
</p></dd></dl>


<a class="anchor" id="XREFsurface"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-surface"><span><strong class="def-name">surface</strong> <code class="def-code-arguments">(<var class="var">x</var>, <var class="var">y</var>, <var class="var">z</var>, <var class="var">c</var>)</code><a class="copiable-link" href="#index-surface"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-surface-1"><span><strong class="def-name">surface</strong> <code class="def-code-arguments">(<var class="var">x</var>, <var class="var">y</var>, <var class="var">z</var>)</code><a class="copiable-link" href="#index-surface-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-surface-2"><span><strong class="def-name">surface</strong> <code class="def-code-arguments">(<var class="var">z</var>, <var class="var">c</var>)</code><a class="copiable-link" href="#index-surface-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-surface-3"><span><strong class="def-name">surface</strong> <code class="def-code-arguments">(<var class="var">z</var>)</code><a class="copiable-link" href="#index-surface-3"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-surface-4"><span><strong class="def-name">surface</strong> <code class="def-code-arguments">(&hellip;, <var class="var">prop</var>, <var class="var">val</var>, &hellip;)</code><a class="copiable-link" href="#index-surface-4"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-surface-5"><span><strong class="def-name">surface</strong> <code class="def-code-arguments">(<var class="var">hax</var>, &hellip;)</code><a class="copiable-link" href="#index-surface-5"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-surface-6"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">surface</strong> <code class="def-code-arguments">(&hellip;)</code><a class="copiable-link" href="#index-surface-6"> &para;</a></span></dt>
<dd><p>Create a surface graphic object given matrices <var class="var">x</var> and <var class="var">y</var> from
<code class="code">meshgrid</code> and a matrix of values <var class="var">z</var> corresponding to the
<var class="var">x</var> and <var class="var">y</var> coordinates of the surface.
</p>
<p>If <var class="var">x</var> and <var class="var">y</var> are vectors, then a typical vertex is
(<var class="var">x</var>(j), <var class="var">y</var>(i), <var class="var">z</var>(i,j)).  Thus, columns of <var class="var">z</var> correspond
to different <var class="var">x</var> values and rows of <var class="var">z</var> correspond to different
<var class="var">y</var> values.  If only a single input <var class="var">z</var> is given then <var class="var">x</var> is
taken to be <code class="code">1:columns (<var class="var">z</var>)</code> and <var class="var">y</var> is
<code class="code">1:rows (<var class="var">z</var>)</code>.
</p>
<p>Any property/value input pairs are assigned to the surface object.
</p>
<p>If the first argument <var class="var">hax</var> is an axes handle, then plot into this axes,
rather than the current axes returned by <code class="code">gca</code>.
</p>
<p>The optional return value <var class="var">h</var> is a graphics handle to the created
surface object.
</p>
<p>Programming Note: The full list of properties is documented at
<a class="ref" href="Surface-Properties.html">Surface Properties</a>.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="Three_002dDimensional-Plots.html#XREFsurf">surf</a>, <a class="ref" href="Three_002dDimensional-Plots.html#XREFmesh">mesh</a>, <a class="ref" href="#XREFpatch">patch</a>, <a class="ref" href="#XREFline">line</a>.
</p></dd></dl>


<a class="anchor" id="XREFlight"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-light"><span><strong class="def-name">light</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-light"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-light-1"><span><strong class="def-name">light</strong> <code class="def-code-arguments">(&hellip;, &quot;<var class="var">prop</var>&quot;, <var class="var">val</var>, &hellip;)</code><a class="copiable-link" href="#index-light-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-light-2"><span><strong class="def-name">light</strong> <code class="def-code-arguments">(<var class="var">hax</var>, &hellip;)</code><a class="copiable-link" href="#index-light-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-light-3"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">light</strong> <code class="def-code-arguments">(&hellip;)</code><a class="copiable-link" href="#index-light-3"> &para;</a></span></dt>
<dd><p>Create a light object in the current axes or for axes <var class="var">hax</var>.
</p>
<p>When a light object is present in an axes object, and the properties
<code class="code">&quot;EdgeLighting&quot;</code> or <code class="code">&quot;FaceLighting&quot;</code> of a <code class="code">patch</code> or
<code class="code">surface</code> object are set to a value other than <code class="code">&quot;none&quot;</code>, these
objects are drawn with lighting effects.  Supported values for Lighting
properties are <code class="code">&quot;none&quot;</code> (no lighting effects), <code class="code">&quot;flat&quot;</code> (faceted
look of the objects), and <code class="code">&quot;gouraud&quot;</code> (linear interpolation of the
lighting effects between the vertices).  If the lighting mode is set to
<code class="code">&quot;flat&quot;</code>, the <code class="code">&quot;FaceNormals&quot;</code> property is used for lighting.
For <code class="code">&quot;gouraud&quot;</code>, the <code class="code">&quot;VertexNormals&quot;</code> property is used.
</p>
<p>Up to eight light objects are supported per axes.  (Implementation
dependent)
</p>
<p>Lighting is only supported for OpenGL graphic toolkits (i.e., <code class="code">&quot;fltk&quot;</code>
and <code class="code">&quot;qt&quot;</code>).
</p>
<p>A light object has the following properties which alter the appearance of
the plot.
</p>
<dl class="table">
<dt><code class="code">&quot;Color&quot;:</code> The color of the light can be passed as an</dt>
<dd><p>RGB-vector (e.g., <code class="code">[1 0 0]</code> for red) or as a string (e.g., <code class="code">&quot;r&quot;</code>
for red).  The default color is white (<code class="code">[1 1 1]</code>).
</p>
</dd>
<dt><code class="code">&quot;Position&quot;:</code> The direction from which the light emanates as a</dt>
<dd><p>1x3-vector.  The default direction is <code class="code">[1 0 1]</code>.
</p>
</dd>
<dt><code class="code">&quot;Style&quot;:</code> This string defines whether the light emanates from a</dt>
<dd><p>light source at infinite distance (<code class="code">&quot;infinite&quot;</code>) or from a local point
source (<code class="code">&quot;local&quot;</code>).  The default is <code class="code">&quot;infinite&quot;</code>.
</p></dd>
</dl>

<p>If the first argument <var class="var">hax</var> is an axes handle, then add the light object
to this axes, rather than the current axes returned by <code class="code">gca</code>.
</p>
<p>The optional return value <var class="var">h</var> is a graphics handle to the created light
object.
</p>
<p>Programming Note: The full list of properties is documented at
<a class="ref" href="Light-Properties.html">Light Properties</a>.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="Three_002dDimensional-Plots.html#XREFlighting">lighting</a>, <a class="ref" href="Three_002dDimensional-Plots.html#XREFmaterial">material</a>, <a class="ref" href="#XREFpatch">patch</a>, <a class="ref" href="#XREFsurface">surface</a>.
</p></dd></dl>


</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Handle-Functions.html">Handle Functions</a>, Up: <a href="Graphics-Objects.html">Graphics Objects</a> &nbsp; [<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>