A Simple X-Y Line Plot

Description

Given two Numeric vectors, make a simple x-y line plot.

Sample Data

Say we have the following data (points along a sine curve):

import Numeric as N
x = N.arange(17)*N.pi/8.
y = N.sin(x)

Plotting

The x-y plot then is:

import vcs
v = vcs.init()
v.xvsy(x, y, 'default', 'default', name='Sine Curve')

The two 'default' arguments refer to the graphics method and template that are used. The keyword name gives the title of the plot.

Some bad news: Even a slightly more complex line plot (say, one that includes axis titles) is a lot more work. You can see this in this complex line plot example.

Full Source Code For Example


Notes: This discussion applies to CDAT 3.3.

Return to the Tips and Examples index page.

Updated: December 3, 2003 by Johnny Lin <email address>. License.