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.
13
Extensibility is a core design goal of Chaco, and many people have used the
14
examples as starting points for their own applications.
18
An example showing Chaco's BarPlot class.
20
source: `bar_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/bar_plot.py>`_
22
.. image:: images/bar_plot.png
26
Demonstrates chaco performance with large datasets.
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.
33
Zooming with the mousewheel and the zoombox (as described in simple_line.py)
34
is also available, but panning is not.
36
source: `bigdata.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/bigdata.py>`_
38
.. image:: images/bigdata.png
40
``cursor_tool_demo.py``
41
-----------------------
42
A Demonstration of the CursorTool functionality
44
Left-button drag to move the cursors round.
45
Right-drag to pan the plots. 'z'-key to Zoom
47
source: `cursor_tool_demo.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/cursor_tool_demo.py>`_
49
.. image:: images/cursor_tool_demo.png
53
Draws a line plot with several points labelled. Demonstrates how to annotate
56
source: `data_labels.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/data_labels.py>`_
58
.. image:: images/data_labels.png
62
Example of how to use a DataView and bare renderers to create plots.
64
source: `data_view.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/data_view.py>`_
66
.. image:: images/data_view.png
70
Allows editing of a line plot.
72
source: `edit_line.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/edit_line.py>`_
74
.. image:: images/edit_line.png
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.
82
source: `financial_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/financial_plot.py>`_
84
.. image:: images/financial_plot.png
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
94
source: `financial_plot_dates.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/financial_plot_dates.py>`_
96
.. image:: images/financial_plot_dates.png
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.
104
source: `multiaxis.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/multiaxis.py>`_
106
.. image:: images/multiaxis.png
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
118
source: `multiaxis_using_Plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/multiaxis_using_Plot.py>`_
120
.. image:: images/multiaxis_using_Plot.png
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.
127
source: `noninteractive.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/noninteractive.py>`_
129
.. image:: images/noninteractive.png
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.
137
source: `range_selection_demo.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/range_selection_demo.py>`_
139
.. image:: images/range_selection_demo.png
143
Draws several overlapping line plots.
145
Double-clicking on line or scatter plots opens a Traits editor for the plot.
147
source: `scales_test.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/scales_test.py>`_
149
.. image:: images/scales_test.png
153
Draws several overlapping line plots.
155
Double-clicking on line or scatter plots opens a Traits editor for the plot.
157
source: `simple_line.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/simple_line.py>`_
159
.. image:: images/simple_line.png
165
Draws a static polar plot.
167
source: `simple_polar.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/simple_polar.py>`_
169
.. image:: images/simple_polar.png
173
Tornado plot example from Brennan Williams.
175
source: `tornado.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/tornado.py>`_
177
.. image:: images/tornado.png
181
Demonstrates plots sharing datasources, ranges, etc...
183
source: `two_plots.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/two_plots.py>`_
185
.. image:: images/two_plots.png
189
Draws a static plot of bessel functions, oriented vertically, side-by-side.
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).
194
source: `vertical_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/vertical_plot.py>`_
196
.. image:: images/vertical_plot.png
200
Allows isometric viewing of a 3-D data cube (downloads the necessary data, about 7.8 MB)
202
source: `data_cube.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/advanced/data_cube.py>`_
204
.. image:: images/data_cube.png
208
This demo shows how Chaco and Traits can be used to easily build a data
209
acquisition and visualization system.
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?
217
source: `data_stream.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/advanced/data_stream.py>`_
219
.. image:: images/data_stream.png
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.
226
source: `scalar_image_function_inspector.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/advanced/scalar_image_function_inspector.py>`_
228
.. image:: images/scalar_image_function_inspector.png
231
--------------------------------------
232
This plot displays the audio spectrum from the microphone.
234
source: `spectrum.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/advanced/spectrum.py>`_
236
.. image:: images/spectrum.png
238
``cmap_image_plot.py``
239
----------------------
240
Draws a colormapped image plot.
242
source: `cmap_image_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/cmap_image_plot.py>`_
244
.. image:: images/cmap_image_plot.png
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.
251
source: `cmap_image_select.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/cmap_image_select.py>`_
253
.. image:: images/cmap_image_select.png
257
Draws a colormapped scatterplot of some random data. Selection works the same as in cmap_image_select.py.
259
source: `cmap_scatter.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/cmap_scatter.py>`_
261
.. image:: images/cmap_scatter.png
263
``contour_cmap_plot.py``
264
--------------------------
265
Renders some contoured and colormapped images of a scalar value field.
267
source: `countour_cmap_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/contour_cmap_plot.py>`_
269
.. image:: images/contour_cmap_plot.png
273
Draws an contour polygon plot with a contour line plot on top.
275
source: `countour_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/contour_plot.py>`_
277
.. image:: images/contour_plot.png
279
``grid_container.py``
280
---------------------
281
Draws several overlapping line plots.
283
source: `grid_container.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/grid_container.py>`_
285
.. image:: images/grid_container.png
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.
292
source: `grid_container_aspect_ratio.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/grid_container_aspect_ratio.py>`_
294
.. image:: images/grid_container_aspect_ratio.png
296
``image_from_file.py``
297
----------------------
298
Loads and saves RGB images from disk.
300
source: `image_from_file.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/image_from_file.py>`_
302
.. image:: images/image_from_file.png
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.
309
source: `image_inspector.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/image_inspector.py>`_
311
.. image:: images/image_inspector.png
315
Draws a simple RGB image
317
source: `image_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/image_plot.py>`_
319
.. image:: images/image_plot.png
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.
327
source: `inset_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/inset_plot.py>`_
329
.. image:: images/inset_plot.png
333
Demonstrates using a line segment drawing tool on top of the scatter plot from
336
source: `line_drawing.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/line_drawing.py>`_
338
.. image:: images/line_drawing.png
342
Draws some x-y line and scatter plots.
344
source: `line_plot1.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/line_plot1.py>`_
346
.. image:: images/line_plot1.png
348
``line_plot_hold.py``
349
---------------------
350
Demonstrates the different 'hold' styles of LinePlot.
352
source: `line_plot_hold.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/line_plot_hold.py>`_
354
.. image:: images/line_plot_hold.png
358
Draws some x-y log plots. (No Tools).
360
source: `log_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/log_plot.py>`_
362
.. image:: images/log_plot.png
366
This plot displays chaco's ability to handle data interlaced with NaNs.
368
source: `nans_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/nans_plot.py>`_
370
.. image:: images/nans_plot.png
374
Draws some different polygons.
376
source: `polygon_plot.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/polygon_plot.py>`_
378
.. image:: images/polygon_plot.png
382
Shares same basic interactions as polygon_plot.py, but adds a new one:
383
right-click and drag to move a polygon around.
385
source: `polygon_move.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/polygon_move.py>`_
387
.. image:: images/polygon_move.png
391
Demonstrates the Regression Selection tool.
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.
398
source: `regression.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/regression.py>`_
400
.. image:: images/regression.png
404
Draws a simple scatterplot of a set of random points.
406
source: `scatter.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/scatter.py>`_
408
.. image:: images/scatter.png
410
``scatter_inspector.py``
411
------------------------
412
Example of using tooltips on Chaco plots.
414
source: `scatter_inspector.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/scatter_inspector.py>`_
416
.. image:: images/scatter_inspector.png
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.
425
source: `scatter_select.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/scatter_select.py>`_
427
.. image:: images/scatter_select.png
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]
438
Draws some x-y line and scatter plots.
440
source: `scrollbar.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/scrollbar.py>`_
442
.. image:: images/scrollbar.png
446
Draws some x-y line and scatter plots.
448
source: `tabbed_plots.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/tabbed_plots.py>`_
450
.. image:: images/tabbed_plots1.png
451
.. image:: images/tabbed_plots2.png
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
460
source: `traits_editor.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/traits_editor.py>`_
462
.. image:: images/traits_editor.png
464
``zoomable_colorbar.py``
465
------------------------
466
Draws a colormapped scatterplot of some random data.
468
Interactions on the plot are the same as for simple_line.py, and additionally,
469
pan and zoom are available on the colorbar.
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.
475
source: `zoomable_colorbar.py <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/basic/zoomable_colorbar.py>`_
477
.. image:: images/zoomable_colorbar.png
480
------------------------
481
The main executable file for the zoom_plot demo.
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.
487
source: `zoomed_plot <https://svn.enthought.com/enthought/browser/Chaco/trunk/examples/zoomed_plot/>`_
489
.. image:: images/zoomed_plot.png