~ubuntu-branches/ubuntu/trusty/python-chaco/trusty-proposed

« back to all changes in this revision

Viewing changes to docs/source/annotated_examples.rst

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2010-02-28 14:05:25 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20100228140525-1eo43ddoakb2j3j9
Tags: 3.3.0-1
* New upstream release
* Switch to source format 3.0 (quilt)
* Bump Standards-Version to 3.8.4
* Remove transition package: python-enthought-chaco2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
.. _examples:
3
 
 
4
 
##################
5
 
Annotated Examples
6
 
##################
7
 
 
8
 
This section describes each of the examples provided with Chaco.  Each example
9
 
is designed to be a stand-alone demonstration of some of Chaco's features.
10
 
Though they are simple, many of the examples have capabilities that are
11
 
difficult to find in other plotting packages.
12
 
 
13
 
Extensibility is a core design goal of Chaco, and many people have used the
14
 
examples as starting points for their own applications.
15
 
 
16
 
``bar_plot.py``
17
 
---------------
18
 
An example showing Chaco's BarPlot class.
19
 
 
20
 
source: `bar_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/bar_plot.py>`_
21
 
 
22
 
.. image:: images/bar_plot.png
23
 
 
24
 
``bigdata.py``
25
 
--------------
26
 
Demonstrates chaco performance with large datasets.
27
 
 
28
 
There are 10 plots with 100,000 points each.  Right-click and drag to
29
 
create a range selection region.  The region can be moved around and
30
 
resized (drag the edges).  These interactions are very fast because
31
 
of the backbuffering built into chaco.
32
 
 
33
 
Zooming with the mousewheel and the zoombox (as described in simple_line.py)
34
 
is also available, but panning is not.
35
 
 
36
 
source: `bigdata.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/bigdata.py>`_
37
 
 
38
 
.. image:: images/bigdata.png
39
 
 
40
 
``cursor_tool_demo.py``
41
 
-----------------------
42
 
A Demonstration of the CursorTool functionality
43
 
 
44
 
Left-button drag to move the cursors round.
45
 
Right-drag to pan the plots. 'z'-key to Zoom
46
 
 
47
 
source: `cursor_tool_demo.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/cursor_tool_demo.py>`_
48
 
 
49
 
.. image:: images/cursor_tool_demo.png
50
 
 
51
 
``data_labels.py``
52
 
------------------
53
 
Draws a line plot with several points labelled.  Demonstrates how to annotate
54
 
plots.
55
 
 
56
 
source: `data_labels.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/data_labels.py>`_
57
 
 
58
 
.. image:: images/data_labels.png
59
 
 
60
 
``data_view.py``
61
 
----------------
62
 
Example of how to use a DataView and bare renderers to create plots.
63
 
 
64
 
source: `data_view.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/data_view.py>`_
65
 
 
66
 
.. image:: images/data_view.png
67
 
 
68
 
``edit_line.py``
69
 
----------------
70
 
Allows editing of a line plot.
71
 
 
72
 
source: `edit_line.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/edit_line.py>`_
73
 
 
74
 
.. image:: images/edit_line.png
75
 
 
76
 
``financial_plot.py``
77
 
---------------------
78
 
Implementation of a standard financial plot visualization using Chaco renderers
79
 
and scales. Right-clicking and selecting an area in the top window zooms in
80
 
the corresponding area in the lower window.
81
 
 
82
 
source: `financial_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/financial_plot.py>`_
83
 
 
84
 
.. image:: images/financial_plot.png
85
 
 
86
 
``financial_plot_dates.py``
87
 
---------------------------
88
 
Implementation of a standard financial plot visualization using Chaco renderers
89
 
and scales. Right-clicking and selecting an area in the top window zooms in
90
 
the corresopnding area in the lower window.
91
 
This differs from the financial_plot.py example in that it uses a date-oriented
92
 
axis.
93
 
 
94
 
source: `financial_plot_dates.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/financial_plot_dates.py>`_
95
 
 
96
 
.. image:: images/financial_plot_dates.png
97
 
 
98
 
``multiaxis.py``
99
 
----------------
100
 
Draws several overlapping line plots like simple_line.py, but uses a separate
101
 
Y range for each plot.  Also has a second Y-axis on the right hand side.
102
 
Demonstrates use of the BroadcasterTool.
103
 
 
104
 
source: `multiaxis.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/multiaxis.py>`_
105
 
 
106
 
.. image:: images/multiaxis.png
107
 
 
108
 
``multiaxis_using_Plot.py``
109
 
---------------------------
110
 
Draws some x-y line and scatter plots. On the left hand plot:
111
 
 - Left-drag pans the plot.
112
 
 - Mousewheel up and down zooms the plot in and out.
113
 
 - Pressing "z" opens the Zoom Box, and you can click-drag a rectangular 
114
 
   region to zoom. If you use a sequence of zoom boxes, pressing alt-left-arrow
115
 
   and alt-right-arrow moves you forwards and backwards through the "zoom 
116
 
   history".
117
 
 
118
 
source: `multiaxis_using_Plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/multiaxis_using_Plot.py>`_
119
 
 
120
 
.. image:: images/multiaxis_using_Plot.png
121
 
 
122
 
``noninteractive.py``
123
 
---------------------
124
 
This demonstrates how to create a plot offscreen and save it to an image file
125
 
on disk. The image is what is saved.
126
 
 
127
 
source: `noninteractive.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/noninteractive.py>`_
128
 
 
129
 
.. image:: images/noninteractive.png
130
 
 
131
 
``range_selection_demo.py``
132
 
---------------------------
133
 
Demo of the RangeSelection on a line plot.  Left-click and drag creates a
134
 
horizontal range selection; this selection can then be dragged around, or
135
 
resized by dragging its edges.
136
 
 
137
 
source: `range_selection_demo.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/range_selection_demo.py>`_
138
 
 
139
 
.. image:: images/range_selection_demo.png
140
 
 
141
 
``scales_test.py``
142
 
------------------
143
 
Draws several overlapping line plots.
144
 
 
145
 
Double-clicking on line or scatter plots opens a Traits editor for the plot.
146
 
 
147
 
source: `scales_test.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/scales_test.py>`_
148
 
 
149
 
.. image:: images/scales_test.png
150
 
 
151
 
``simple_line.py``
152
 
------------------
153
 
Draws several overlapping line plots.
154
 
 
155
 
Double-clicking on line or scatter plots opens a Traits editor for the plot.
156
 
 
157
 
source: `simple_line.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/simple_line.py>`_
158
 
 
159
 
.. image:: images/simple_line.png
160
 
 
161
 
.. [COMMENT]::
162
 
 
163
 
    ``simple_polar.py``
164
 
    -------------------
165
 
    Draws a static polar plot.
166
 
 
167
 
    source: `simple_polar.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/simple_polar.py>`_
168
 
 
169
 
    .. image:: images/simple_polar.png
170
 
 
171
 
``tornado.py``
172
 
--------------
173
 
Tornado plot example from Brennan Williams.
174
 
 
175
 
source: `tornado.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/tornado.py>`_
176
 
 
177
 
.. image:: images/tornado.png
178
 
 
179
 
``two_plots.py``
180
 
----------------
181
 
Demonstrates plots sharing datasources, ranges, etc...
182
 
 
183
 
source: `two_plots.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/two_plots.py>`_
184
 
 
185
 
.. image:: images/two_plots.png
186
 
 
187
 
``vertical_plot.py``
188
 
--------------------
189
 
Draws a static plot of bessel functions, oriented vertically, side-by-side.
190
 
 
191
 
You can experiment with using different containers (uncomment lines 32-33)
192
 
or different orientations on the plots (comment out line 43 and uncomment 44).
193
 
 
194
 
source: `vertical_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/vertical_plot.py>`_
195
 
 
196
 
.. image:: images/vertical_plot.png
197
 
 
198
 
``data_cube.py``
199
 
----------------
200
 
Allows isometric viewing of a 3-D data cube (downloads the necessary data, about 7.8 MB)
201
 
 
202
 
source: `data_cube.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/advanced/data_cube.py>`_
203
 
 
204
 
.. image:: images/data_cube.png
205
 
 
206
 
``data_stream.py``
207
 
------------------
208
 
This demo shows how Chaco and Traits can be used to easily build a data
209
 
acquisition and visualization system.
210
 
 
211
 
Two frames are opened: one has the plot and allows configuration of
212
 
various plot properties, and one which simulates controls for the hardware
213
 
device from which the data is being acquired; in this case, it is a mockup
214
 
random number generator whose mean and standard deviation 
215
 
.. TODO: Sentence incomplete?
216
 
 
217
 
source: `data_stream.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/advanced/data_stream.py>`_
218
 
 
219
 
.. image:: images/data_stream.png
220
 
 
221
 
``scalar_image_function_inspector.py``
222
 
--------------------------------------
223
 
Renders a colormapped image of a scalar value field, and a cross section
224
 
chosen by a line interactor.
225
 
 
226
 
source: `scalar_image_function_inspector.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/advanced/scalar_image_function_inspector.py>`_
227
 
 
228
 
.. image:: images/scalar_image_function_inspector.png
229
 
 
230
 
``spectrum.py``
231
 
--------------------------------------
232
 
This plot displays the audio spectrum from the microphone.
233
 
 
234
 
source: `spectrum.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/advanced/spectrum.py>`_
235
 
 
236
 
.. image:: images/spectrum.png
237
 
 
238
 
``cmap_image_plot.py``
239
 
----------------------
240
 
Draws a colormapped image plot.
241
 
 
242
 
source: `cmap_image_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/cmap_image_plot.py>`_
243
 
 
244
 
.. image:: images/cmap_image_plot.png
245
 
 
246
 
``cmap_image_select.py``
247
 
-------------------------
248
 
Draws a colormapped image plot. Selecting colors in the spectrum on the right
249
 
highlights the corresponding colors in the color map.
250
 
 
251
 
source: `cmap_image_select.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/cmap_image_select.py>`_
252
 
 
253
 
.. image:: images/cmap_image_select.png
254
 
 
255
 
``cmap_scatter.py``
256
 
-------------------
257
 
Draws a colormapped scatterplot of some random data. Selection works the same as in cmap_image_select.py.
258
 
 
259
 
source: `cmap_scatter.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/cmap_scatter.py>`_
260
 
 
261
 
.. image:: images/cmap_scatter.png
262
 
 
263
 
``contour_cmap_plot.py``
264
 
--------------------------
265
 
Renders some contoured and colormapped images of a scalar value field.
266
 
 
267
 
source: `countour_cmap_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/contour_cmap_plot.py>`_
268
 
 
269
 
.. image:: images/contour_cmap_plot.png
270
 
 
271
 
``contour_plot.py``
272
 
-------------------
273
 
Draws an contour polygon plot with a contour line plot on top.
274
 
 
275
 
source: `countour_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/contour_plot.py>`_
276
 
 
277
 
.. image:: images/contour_plot.png
278
 
 
279
 
``grid_container.py``
280
 
---------------------
281
 
Draws several overlapping line plots.
282
 
 
283
 
source: `grid_container.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/grid_container.py>`_
284
 
 
285
 
.. image:: images/grid_container.png
286
 
 
287
 
``grid_container_aspect_ratio``
288
 
-------------------------------
289
 
Similar to grid_container.py, but demonstrates Chaco's capability to used a
290
 
fixed screen space aspect ratio for plot components.
291
 
 
292
 
source: `grid_container_aspect_ratio.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/grid_container_aspect_ratio.py>`_
293
 
 
294
 
.. image:: images/grid_container_aspect_ratio.png
295
 
 
296
 
``image_from_file.py``
297
 
----------------------
298
 
Loads and saves RGB images from disk.
299
 
 
300
 
source: `image_from_file.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/image_from_file.py>`_
301
 
 
302
 
.. image:: images/image_from_file.png
303
 
 
304
 
``image_inspector.py``
305
 
----------------------
306
 
Demonstrates the ImageInspectorTool and overlay on a colormapped image plot.
307
 
The underlying plot is similar to the one in cmap_image_plot.py.
308
 
 
309
 
source: `image_inspector.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/image_inspector.py>`_
310
 
 
311
 
.. image:: images/image_inspector.png
312
 
 
313
 
``image_plot.py``
314
 
-----------------
315
 
Draws a simple RGB image
316
 
 
317
 
source: `image_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/image_plot.py>`_
318
 
 
319
 
.. image:: images/image_plot.png
320
 
 
321
 
``inset_plot.py``
322
 
-----------------
323
 
A modification of line_plot1.py that shows the second plot as a subwindow of
324
 
the first.  You can pan and zoom the second plot just like the first, and you
325
 
can move it around my right-click and dragging in the smaller plot.
326
 
 
327
 
source: `inset_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/inset_plot.py>`_
328
 
 
329
 
.. image:: images/inset_plot.png
330
 
 
331
 
``line_drawing.py``
332
 
--------------------
333
 
Demonstrates using a line segment drawing tool on top of the scatter plot from
334
 
simple_scatter.py.
335
 
 
336
 
source: `line_drawing.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/line_drawing.py>`_
337
 
 
338
 
.. image:: images/line_drawing.png
339
 
 
340
 
``line_plot1.py``
341
 
-----------------
342
 
Draws some x-y line and scatter plots.
343
 
 
344
 
source: `line_plot1.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/line_plot1.py>`_
345
 
 
346
 
.. image:: images/line_plot1.png
347
 
 
348
 
``line_plot_hold.py``
349
 
---------------------
350
 
Demonstrates the different 'hold' styles of LinePlot.
351
 
 
352
 
source: `line_plot_hold.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/line_plot_hold.py>`_
353
 
 
354
 
.. image:: images/line_plot_hold.png
355
 
 
356
 
``log_plot.py``
357
 
-----------------
358
 
Draws some x-y log plots. (No Tools).
359
 
 
360
 
source: `log_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/log_plot.py>`_
361
 
 
362
 
.. image:: images/log_plot.png
363
 
 
364
 
``nans_plot.py``
365
 
----------------
366
 
This plot displays chaco's ability to handle data interlaced with NaNs.
367
 
 
368
 
source: `nans_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/nans_plot.py>`_
369
 
 
370
 
.. image:: images/nans_plot.png
371
 
 
372
 
``polygon_plot.py``
373
 
-------------------
374
 
Draws some different polygons.
375
 
 
376
 
source: `polygon_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/polygon_plot.py>`_
377
 
 
378
 
.. image:: images/polygon_plot.png
379
 
 
380
 
``polygon_move.py``
381
 
-------------------
382
 
Shares same basic interactions as polygon_plot.py, but adds a new one: 
383
 
right-click and drag to move a polygon around.
384
 
 
385
 
source: `polygon_move.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/polygon_move.py>`_
386
 
 
387
 
.. image:: images/polygon_move.png
388
 
 
389
 
``regression.py``
390
 
-------------------
391
 
Demonstrates the Regression Selection tool.
392
 
 
393
 
Hold down the left mouse button to use the mouse to draw a selection region
394
 
around some points, and a line fit is drawn through the center of the points.
395
 
The parameters of the line are displayed at the bottom of the plot region.  You
396
 
can do this repeatedly to draw different regions.
397
 
 
398
 
source: `regression.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/regression.py>`_
399
 
 
400
 
.. image:: images/regression.png
401
 
 
402
 
``scatter.py``
403
 
-------------------
404
 
Draws a simple scatterplot of a set of random points.
405
 
 
406
 
source: `scatter.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/scatter.py>`_
407
 
 
408
 
.. image:: images/scatter.png
409
 
 
410
 
``scatter_inspector.py``
411
 
------------------------
412
 
Example of using tooltips on Chaco plots.
413
 
 
414
 
source: `scatter_inspector.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/scatter_inspector.py>`_
415
 
 
416
 
.. image:: images/scatter_inspector.png
417
 
 
418
 
``scatter_select.py``
419
 
------------------------
420
 
Draws a simple scatterplot of random data.  The only interaction available is
421
 
the lasso selector, which allows you to circle a set of points.  Upon
422
 
completion of the lasso operation, the indices of the selected points are
423
 
printed to the console.
424
 
 
425
 
source: `scatter_select.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/scatter_select.py>`_
426
 
 
427
 
.. image:: images/scatter_select.png
428
 
 
429
 
console output::
430
 
 
431
 
    New selection: 
432
 
        [789  799  819  830  835  836  851  867  892  901  902  909  913  924  929
433
 
         931  933  938  956  971  972  975  976  996  999 1011 1014 1016 1021 1030
434
 
         1045 1049 1058 1061 1073 1086 1087 1088]
435
 
 
436
 
``scrollbar.py``
437
 
-------------------
438
 
Draws some x-y line and scatter plots.
439
 
 
440
 
source: `scrollbar.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/scrollbar.py>`_
441
 
 
442
 
.. image:: images/scrollbar.png
443
 
 
444
 
``tabbed_plots.py``
445
 
-------------------
446
 
Draws some x-y line and scatter plots.
447
 
 
448
 
source: `tabbed_plots.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/tabbed_plots.py>`_
449
 
 
450
 
.. image:: images/tabbed_plots1.png
451
 
.. image:: images/tabbed_plots2.png
452
 
 
453
 
``traits_editor.py``
454
 
--------------------
455
 
This example creates a simple 1-D function examiner, illustrating the use of
456
 
ChacoPlotEditors for displaying simple plot relations, as well as Traits UI
457
 
integration. Any 1-D numpy/scipy.special function works in the function
458
 
text box.
459
 
 
460
 
source: `traits_editor.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/traits_editor.py>`_
461
 
 
462
 
.. image:: images/traits_editor.png
463
 
 
464
 
``zoomable_colorbar.py``
465
 
------------------------
466
 
Draws a colormapped scatterplot of some random data.
467
 
 
468
 
Interactions on the plot are the same as for simple_line.py, and additionally, 
469
 
pan and zoom are available on the colorbar. 
470
 
 
471
 
Left-click pans the colorbar's data region.  Right-click-drag 
472
 
selects a zoom range.  Mousewheel up and down zoom in and out on
473
 
the data bounds of the color bar.
474
 
 
475
 
source: `zoomable_colorbar.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/zoomable_colorbar.py>`_
476
 
 
477
 
.. image:: images/zoomable_colorbar.png
478
 
 
479
 
``zoomed_plot``
480
 
------------------------
481
 
The main executable file for the zoom_plot demo.
482
 
 
483
 
Right-click and drag on the upper plot to select a region to view in detail
484
 
in the lower plot.  The selected region can be moved around by dragging,
485
 
or resized by clicking on one of its edges and dragging.
486
 
 
487
 
source: `zoomed_plot <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/zoomed_plot/>`_
488
 
 
489
 
.. image:: images/zoomed_plot.png