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

« back to all changes in this revision

Viewing changes to examples/demo/shell/lines.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
 
"""This example displays some line plots in different colors and styles using
2
 
the chaco.shell subpackage.
3
 
 
4
 
The functions in the chaco.shell package allow us to quickly generate plots
5
 
with some basic interactivity without using the object-oriented core of Chaco.
6
 
"""
7
 
 
8
 
from numpy import linspace, pi, sin, cos
9
 
from chaco.shell import plot, hold, title, show
10
 
 
11
 
# Create some data
12
 
x = linspace(-2*pi, 2*pi, 100)
13
 
y1 = sin(x)
14
 
y2 = cos(x)
15
 
 
16
 
# Create some line plots using the plot() command and using
17
 
# Matlab-style format specifiers
18
 
plot(x, y1, "b-", bgcolor="white")
19
 
hold()
20
 
plot(x, y2, "g-.", marker_size=2)
21
 
 
22
 
# Set the plot title
23
 
title("simple line plots")
24
 
 
25
 
# If running this from the command line and outside of a wxPython
26
 
# application or process, the show() command is necessary to keep
27
 
# the plot from disappearing instantly.  If a wxPython mainloop
28
 
# is already running, then this command is not necessary.
29
 
show()