~ubuntu-branches/ubuntu/trusty/python-gnuplot/trusty

« back to all changes in this revision

Viewing changes to doc/Gnuplot/PlotItems/PlotItem.html

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2005-01-23 00:42:37 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050123004237-0rfjkhe4ii7ky637
Tags: 1.7-5
Fix mouse control in generated plot windows (closes: #291294).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 
2
          "http://www.w3.org/TR/html40/loose.dtd">
 
3
 
 
4
<html>
 
5
         
 
6
  <head>
 
7
    <title>Class: PlotItem</title>
 
8
  </head>
 
9
 
 
10
  <body bgcolor="#ffffff">
 
11
 
 
12
        <p><i><a href="../../index.html">Table of Contents</a></i></p>
 
13
        
 
14
        <table border="0" cellpadding="5" cellspacing="0" width="100%">
 
15
        <tr>
 
16
            <th rowspan="2"
 
17
                valign="top"
 
18
                align="left"
 
19
                width="10%"
 
20
                bgcolor="#88bbee"><font color="#000000">Class: PlotItem</font>
 
21
            </th>
 
22
            <th bgcolor="#88bbee"
 
23
                width="90%"
 
24
                align="right"><font color="#000000">Gnuplot/PlotItems.py</font>
 
25
            </th>
 
26
        </tr>
 
27
        <tr>
 
28
        <td>
 
29
        
 
30
<h3>Plotitem represents an item that can be plotted by gnuplot.</h3>
 
31
<p>    For the finest control over the output, you can create <code>PlotItems</code>
 
32
    yourself with additional keyword options, or derive new classes
 
33
    from <code>PlotItem</code>.</p>
 
34
<p>    The handling of options is complicated by the attempt to allow
 
35
    options and their setting mechanism to be inherited conveniently.
 
36
    Note first that there are some options that can only be set in the
 
37
    constructor then never modified, and others that can be set in the
 
38
    constructor and/or modified using the <code>set_option()</code> member
 
39
    function.  The former are always processed within <code>__init__</code>.  The
 
40
    latter are always processed within <code>set_option</code>, which is called
 
41
    by the constructor.</p>
 
42
<p>    <code>set_option</code> is driven by a class-wide dictionary called
 
43
    <code>_option_list</code>, which is a mapping <code>{ &lt;option&gt; : &lt;setter&gt; }</code> from
 
44
    option name to the function object used to set or change the
 
45
    option.  &lt;setter&gt; is a function object that takes two parameters:
 
46
    <code>self</code> (the <code>PlotItem</code> instance) and the new value requested for
 
47
    the option.  If &lt;setter&gt; is <code>None</code>, then the option is not allowed
 
48
    to be changed after construction and an exception is raised.</p>
 
49
<p>    Any <code>PlotItem</code> that needs to add options can add to this
 
50
    dictionary within its class definition.  Follow one of the
 
51
    examples in this file.  Alternatively it could override the
 
52
    <code>set_option</code> member function if it needs to do wilder things.</p>
 
53
<h4>    Members:</h4>
 
54
<dl>
 
55
<dt>      <code>_basecommand</code></dt>
 
56
<dd>a string holding the elementary argument that
 
57
          must be passed to gnuplot's `plot' command for this item;
 
58
          e.g., <code>sin(x)</code> or <code>"filename.dat"</code>.</dd>
 
59
<dt>      <code>_options</code></dt>
 
60
<dd>a dictionary of (&lt;option&gt;,&lt;string&gt;) tuples
 
61
          corresponding to the plot options that have been set for
 
62
          this instance of the PlotItem.  &lt;option&gt; is the option as
 
63
          specified by the user; &lt;string&gt; is the string that needs to
 
64
          be set in the command line to set that option (or None if no
 
65
          string is needed).  Example:
 
66
<pre>
 
67
              {'title' : ('Data', 'title "Data"'),
 
68
               'with' : ('linespoints', 'with linespoints')}
 
69
</pre>
 
70
</dd>
 
71
</dl>
 
72
<table border="0" cellpadding="5" cellspacing="0" width="100%">
 
73
 
 
74
        <tr>
 
75
            <th bgcolor="#99ccff"
 
76
                rowspan="2"
 
77
                valign="top"
 
78
                align="left"
 
79
                width="20%"
 
80
                >
 
81
                <font color="#000000">
 
82
                  <a name="Methods">Methods</a>&nbsp;
 
83
                </font>
 
84
            </th>
 
85
            <th bgcolor="#99ccff"
 
86
                valign="top"
 
87
                align="left"
 
88
                width="80%"
 
89
                >
 
90
                <font color="#000000">&nbsp;</font>
 
91
            </th>
 
92
        </tr>
 
93
        <tr>
 
94
        <td>
 
95
        
 
96
<a href="#__init__">__init__</a><br>
 
97
<a href="#clear_option">clear_option</a><br>
 
98
<a href="#command">command</a><br>
 
99
<a href="#get_base_command_string">get_base_command_string</a><br>
 
100
<a href="#get_command_option_string">get_command_option_string</a><br>
 
101
<a href="#get_option">get_option</a><br>
 
102
<a href="#pipein">pipein</a><br>
 
103
<a href="#set_option">set_option</a><br>
 
104
<a href="#set_string_option">set_string_option</a><br>
 
105
 
 
106
 
 
107
        <tr>
 
108
            <th bgcolor="#99ccff"
 
109
                rowspan="2"
 
110
                valign="top"
 
111
                align="left"
 
112
                width="20%"
 
113
                >
 
114
                <font color="#000000">
 
115
                  <a name="__init__"></a>&nbsp;
 
116
                </font>
 
117
            </th>
 
118
            <th bgcolor="#99ccff"
 
119
                valign="top"
 
120
                align="left"
 
121
                width="80%"
 
122
                >
 
123
                <font color="#000000">__init__&nbsp;</font>
 
124
            </th>
 
125
        </tr>
 
126
        <tr>
 
127
        <td>
 
128
        <font color="#000088"><pre>
 
129
__init__ ( self,  **keyw )
 
130
 
 
131
</pre></font>
 
132
 
 
133
<h3>Construct a <code>PlotItem</code>.</h3>
 
134
<h4>        Keyword options:</h4>
 
135
<dl>
 
136
<dt>          <code>with=&lt;string&gt;</code></dt>
 
137
<dd>choose how item will be plotted, e.g.,
 
138
              with=<code>points 3 3</code>.</dd>
 
139
<dt>          <code>title=&lt;string&gt;</code></dt>
 
140
<dd>set the title to be associated with the item
 
141
              in the plot legend.</dd>
 
142
<dt>          <code>title=None</code></dt>
 
143
<dd>choose <code>notitle</code> option (omit item from legend).</dd>
 
144
</dl>
 
145
<p>        Note that omitting the title option is different than setting
 
146
        'title=None'; the former chooses gnuplot's default whereas the
 
147
        latter chooses <code>notitle</code>.</p>
 
148
 
 
149
        <tr>
 
150
            <th bgcolor="#99ccff"
 
151
                rowspan="2"
 
152
                valign="top"
 
153
                align="left"
 
154
                width="20%"
 
155
                >
 
156
                <font color="#000000">
 
157
                  <a name="clear_option"></a>&nbsp;
 
158
                </font>
 
159
            </th>
 
160
            <th bgcolor="#99ccff"
 
161
                valign="top"
 
162
                align="left"
 
163
                width="80%"
 
164
                >
 
165
                <font color="#000000">clear_option&nbsp;</font>
 
166
            </th>
 
167
        </tr>
 
168
        <tr>
 
169
        <td>
 
170
        <font color="#000088"><pre>
 
171
clear_option ( self,  name )
 
172
 
 
173
</pre></font>
 
174
 
 
175
<p>Clear (unset) a plot option.  No error if option was not set.</p>
 
176
 
 
177
        <tr>
 
178
            <th bgcolor="#99ccff"
 
179
                rowspan="2"
 
180
                valign="top"
 
181
                align="left"
 
182
                width="20%"
 
183
                >
 
184
                <font color="#000000">
 
185
                  <a name="command"></a>&nbsp;
 
186
                </font>
 
187
            </th>
 
188
            <th bgcolor="#99ccff"
 
189
                valign="top"
 
190
                align="left"
 
191
                width="80%"
 
192
                >
 
193
                <font color="#000000">command&nbsp;</font>
 
194
            </th>
 
195
        </tr>
 
196
        <tr>
 
197
        <td>
 
198
        <font color="#000088"><pre>
 
199
command ( self )
 
200
 
 
201
</pre></font>
 
202
 
 
203
<h3>Build the plot command to be sent to gnuplot.</h3>
 
204
<p>        Build and return the plot command, with options, necessary to
 
205
        display this item.  If anything else needs to be done once per
 
206
        plot, it can be done here too.</p>
 
207
 
 
208
        <tr>
 
209
            <th bgcolor="#99ccff"
 
210
                rowspan="2"
 
211
                valign="top"
 
212
                align="left"
 
213
                width="20%"
 
214
                >
 
215
                <font color="#000000">
 
216
                  <a name="get_base_command_string"></a>&nbsp;
 
217
                </font>
 
218
            </th>
 
219
            <th bgcolor="#99ccff"
 
220
                valign="top"
 
221
                align="left"
 
222
                width="80%"
 
223
                >
 
224
                <font color="#000000">get_base_command_string&nbsp;</font>
 
225
            </th>
 
226
        </tr>
 
227
        <tr>
 
228
        <td>
 
229
        <font color="#000088"><pre>
 
230
get_base_command_string ( self )
 
231
 
 
232
</pre></font>
 
233
 
 
234
<table border="0" cellpadding="5" cellspacing="0" width="100%">
 
235
 
 
236
        <tr>
 
237
            <th bgcolor="#99ccff"
 
238
                rowspan="2"
 
239
                valign="top"
 
240
                align="left"
 
241
                width="20%"
 
242
                >
 
243
                <font color="#000000">
 
244
                  <a name="Exceptions">Exceptions</a>&nbsp;
 
245
                </font>
 
246
            </th>
 
247
            <th bgcolor="#99ccff"
 
248
                valign="top"
 
249
                align="left"
 
250
                width="80%"
 
251
                >
 
252
                <font color="#000000">&nbsp;</font>
 
253
            </th>
 
254
        </tr>
 
255
        <tr>
 
256
        <td>
 
257
        
 
258
NotImplementedError()<br>
 
259
 
 
260
</td></tr>
 
261
</table>
 
262
 
 
263
        <tr>
 
264
            <th bgcolor="#99ccff"
 
265
                rowspan="2"
 
266
                valign="top"
 
267
                align="left"
 
268
                width="20%"
 
269
                >
 
270
                <font color="#000000">
 
271
                  <a name="get_command_option_string"></a>&nbsp;
 
272
                </font>
 
273
            </th>
 
274
            <th bgcolor="#99ccff"
 
275
                valign="top"
 
276
                align="left"
 
277
                width="80%"
 
278
                >
 
279
                <font color="#000000">get_command_option_string&nbsp;</font>
 
280
            </th>
 
281
        </tr>
 
282
        <tr>
 
283
        <td>
 
284
        <font color="#000088"><pre>
 
285
get_command_option_string ( self )
 
286
 
 
287
</pre></font>
 
288
 
 
289
 
 
290
        <tr>
 
291
            <th bgcolor="#99ccff"
 
292
                rowspan="2"
 
293
                valign="top"
 
294
                align="left"
 
295
                width="20%"
 
296
                >
 
297
                <font color="#000000">
 
298
                  <a name="get_option"></a>&nbsp;
 
299
                </font>
 
300
            </th>
 
301
            <th bgcolor="#99ccff"
 
302
                valign="top"
 
303
                align="left"
 
304
                width="80%"
 
305
                >
 
306
                <font color="#000000">get_option&nbsp;</font>
 
307
            </th>
 
308
        </tr>
 
309
        <tr>
 
310
        <td>
 
311
        <font color="#000088"><pre>
 
312
get_option ( self,  name )
 
313
 
 
314
</pre></font>
 
315
 
 
316
<p>Return the setting of an option.  May be overridden.</p>
 
317
<table border="0" cellpadding="5" cellspacing="0" width="100%">
 
318
 
 
319
        <tr>
 
320
            <th bgcolor="#99ccff"
 
321
                rowspan="2"
 
322
                valign="top"
 
323
                align="left"
 
324
                width="20%"
 
325
                >
 
326
                <font color="#000000">
 
327
                  <a name="Exceptions">Exceptions</a>&nbsp;
 
328
                </font>
 
329
            </th>
 
330
            <th bgcolor="#99ccff"
 
331
                valign="top"
 
332
                align="left"
 
333
                width="80%"
 
334
                >
 
335
                <font color="#000000">&nbsp;</font>
 
336
            </th>
 
337
        </tr>
 
338
        <tr>
 
339
        <td>
 
340
        
 
341
KeyError( 'option %s is not set!' % name )<br>
 
342
 
 
343
</td></tr>
 
344
</table>
 
345
 
 
346
        <tr>
 
347
            <th bgcolor="#99ccff"
 
348
                rowspan="2"
 
349
                valign="top"
 
350
                align="left"
 
351
                width="20%"
 
352
                >
 
353
                <font color="#000000">
 
354
                  <a name="pipein"></a>&nbsp;
 
355
                </font>
 
356
            </th>
 
357
            <th bgcolor="#99ccff"
 
358
                valign="top"
 
359
                align="left"
 
360
                width="80%"
 
361
                >
 
362
                <font color="#000000">pipein&nbsp;</font>
 
363
            </th>
 
364
        </tr>
 
365
        <tr>
 
366
        <td>
 
367
        <font color="#000088"><pre>
 
368
pipein ( self,  f )
 
369
 
 
370
</pre></font>
 
371
 
 
372
<h3>Pipe necessary inline data to gnuplot.</h3>
 
373
<p>        If the plot command requires data to be put on stdin (i.e.,
 
374
        <code>plot "-"</code>), this method should put that data there.  Can be
 
375
        overridden in derived classes.</p>
 
376
 
 
377
        <tr>
 
378
            <th bgcolor="#99ccff"
 
379
                rowspan="2"
 
380
                valign="top"
 
381
                align="left"
 
382
                width="20%"
 
383
                >
 
384
                <font color="#000000">
 
385
                  <a name="set_option"></a>&nbsp;
 
386
                </font>
 
387
            </th>
 
388
            <th bgcolor="#99ccff"
 
389
                valign="top"
 
390
                align="left"
 
391
                width="80%"
 
392
                >
 
393
                <font color="#000000">set_option&nbsp;</font>
 
394
            </th>
 
395
        </tr>
 
396
        <tr>
 
397
        <td>
 
398
        <font color="#000088"><pre>
 
399
set_option ( self,  **keyw )
 
400
 
 
401
</pre></font>
 
402
 
 
403
<h3>Set or change a plot option for this PlotItem.</h3>
 
404
<p>        See documentation for <code>__init__</code> for information about allowed
 
405
        options.  This function can be overridden by derived classes
 
406
        to allow additional options, in which case those options will
 
407
        also be allowed by <code>__init__</code> for the derived class.  However,
 
408
        it is easier to define a new <code>_option_list</code> variable for the
 
409
        derived class.</p>
 
410
<table border="0" cellpadding="5" cellspacing="0" width="100%">
 
411
 
 
412
        <tr>
 
413
            <th bgcolor="#99ccff"
 
414
                rowspan="2"
 
415
                valign="top"
 
416
                align="left"
 
417
                width="20%"
 
418
                >
 
419
                <font color="#000000">
 
420
                  <a name="Exceptions">Exceptions</a>&nbsp;
 
421
                </font>
 
422
            </th>
 
423
            <th bgcolor="#99ccff"
 
424
                valign="top"
 
425
                align="left"
 
426
                width="80%"
 
427
                >
 
428
                <font color="#000000">&nbsp;</font>
 
429
            </th>
 
430
        </tr>
 
431
        <tr>
 
432
        <td>
 
433
        
 
434
Errors.OptionError( 'Cannot modify %s option after construction!', option )<br>
 
435
Errors.OptionError('%s=%s' %( option, value ) )<br>
 
436
 
 
437
</td></tr>
 
438
</table>
 
439
 
 
440
        <tr>
 
441
            <th bgcolor="#99ccff"
 
442
                rowspan="2"
 
443
                valign="top"
 
444
                align="left"
 
445
                width="20%"
 
446
                >
 
447
                <font color="#000000">
 
448
                  <a name="set_string_option"></a>&nbsp;
 
449
                </font>
 
450
            </th>
 
451
            <th bgcolor="#99ccff"
 
452
                valign="top"
 
453
                align="left"
 
454
                width="80%"
 
455
                >
 
456
                <font color="#000000">set_string_option&nbsp;</font>
 
457
            </th>
 
458
        </tr>
 
459
        <tr>
 
460
        <td>
 
461
        <font color="#000088"><pre>
 
462
set_string_option (
 
463
        self,
 
464
        option,
 
465
        value,
 
466
        default,
 
467
        fmt,
 
468
        )
 
469
 
 
470
</pre></font>
 
471
 
 
472
<p>Set an option that takes a string value.</p>
 
473
</td></tr>
 
474
</td></tr>
 
475
</table>
 
476
 
 
477
        </td>
 
478
        </tr>
 
479
        </table>
 
480
 
 
481
        <hr>
 
482
 
 
483
        <p><i><a href="../../index.html">Table of Contents</a></i></p>
 
484
 
 
485
        <font size="-2"><i>This document was automatically generated
 
486
        on Sun Oct 19 17:10:22 2003 by
 
487
        <a href="http://happydoc.sourceforge.net">HappyDoc</a> version
 
488
        2.1</i></font>
 
489
        
 
490
        </body>
 
491
        </html>
 
492
        
 
 
b'\\ No newline at end of file'