~ubuntu-branches/ubuntu/utopic/python-chaco/utopic

« back to all changes in this revision

Viewing changes to examples/tutorials/tutorial2_ipython.py

  • Committer: Package Import Robot
  • Author(s): Andrew Starr-Bochicchio
  • Date: 2014-06-01 17:04:08 UTC
  • mfrom: (7.2.5 sid)
  • Revision ID: package-import@ubuntu.com-20140601170408-m86xvdjd83a4qon0
Tags: 4.4.1-1ubuntu1
* Merge from Debian unstable. Remaining Ubuntu changes:
 - Let the binary-predeb target work on the usr/lib/python* directory
   as we don't have usr/share/pyshared anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
"""Tutorial 2 (IPython) - Getting at our first plot using IPython
2
 
 
3
 
This addendum to Tutorial 2 demonstrates the dynamic nature of the various
4
 
components in Chaco.
5
 
 
6
 
To run this tutorial, change to the directory where this file is located,
7
 
then invoke IPython:
8
 
 
9
 
  ipython --gui=wx
10
 
 
11
 
Then just run this tutorial:
12
 
 
13
 
  run tutorial2_ipython.py
14
 
 
15
 
Once this executes, you will have a Chaco plot window open, and all of the
16
 
functions defined in this file will be available at the IPython prompt.
17
 
(The "plot" variables will also be defined.)
18
 
 
19
 
You can configure some aspects of your plot by using the functions.
20
 
"""
21
 
 
22
 
from tutorial2 import demo
23
 
 
24
 
demo.configure_traits()
25
 
plot = demo.plot
26
 
 
27
 
def xtitle(text):
28
 
    plot.x_axis.title = text
29
 
    plot.request_redraw()
30
 
 
31
 
def ytitle(text):
32
 
    plot.y_axis.title = text
33
 
    plot.request_redraw()
34
 
 
35
 
def xrange(low, high):
36
 
    plot.x_mapper.range.low = low
37
 
    plot.x_mapper.range.high = high
38
 
 
39
 
def yrange(low, high):
40
 
    plot.y_mapper.range.low = low
41
 
    plot.y_mapper.range.high = high
42
 
 
43