Package nltk_lite :: Package draw :: Module plot
[show private | hide private]
[frames | no frames]

Module nltk_lite.draw.plot

A simple tool for plotting functions. Each new Plot object opens a new window, containing the plot for a sinlge function. See the documentation for Plot for information about creating new plots.

Example plots

Plot sin(x) from -10 to 10, with a step of 0.1:
>>> Plot(math.sin)
Plot cos(x) from 0 to 2*pi, with a step of 0.01:
>>> Plot(math.cos, slice(0, 2*math.pi, 0.01))
Plot a list of points (connected by lines).
>>> points = ([1,1], [3,8], [5,3], [6,12], [1,24])
>>> Plot(points)
Plot a list of y-values (connected by lines). Each value[i] is plotted at x=i.
>>> values = [x**2 for x in range(200)]
>>> Plot(values)
Plot a function with logarithmic axes.
>>> def f(x): return 5*x**2+2*x+8
>>> Plot(f, slice(1,10,.1), scale='log')
Plot the same function with semi-logarithmic axes.
>>> Plot(f, slice(1,10,.1),
scale='log-linear')  # logarithmic x; linear y

>>> Plot(f, slice(1,10,.1),
scale='linear-log')  # linear x; logarithmic y

BLT

If BLT and PMW are both installed, then BLT is used to plot graphs. Otherwise, a simple Tkinter-based implementation is used. The Tkinter-based implementation does not display axis values.
Classes
Plot A simple graphical tool for plotting functions.
    Plot Frame Implementations
PlotFrameI A frame for plotting graphs.
CanvasPlotFrame  
BLTPlotFrame  

Generated by Epydoc 2.1 on Tue Sep 5 09:37:21 2006 http://epydoc.sf.net