The WCK Graph Package

April 2004 | Fredrik Lundh

Update 2004-04-21: WCK Graph 0.5 is now available. This version adds more configuration options (including a “spline” interpolation method for line graphs), and a new linear regression demo script that illustrates one way to create a custom overlay.

The WCK Graph package is a simple plotting package for the Widget Construction Kit. The current version supports various 2D plots such as line plots, scatter plots, area plots and bar diagrams.

Unlike many other graph libraries for Python, the WCK Graph library is self-contained, and does not rely on any external C libraries or Python extensions (except for the underlying WCK driver, of course).

Here’s a simple example:

And here’s the program that generated this graph:

from Tkinter import *

import wckgraph
import math

root = Tk()
root.title("sine curve")

w = wckgraph.GraphWidget(root)
w.pack(fill=BOTH, expand=1)

# plot a sine curve
xdata = range(-360, 360+1, 2)
ydata = [math.sin(v * math.pi / 180) for v in xdata]

data = xdata, ydata




The WCK Graph package can be downloaded from the downloads site. You need the tkinter3000 (WCK) and wckgraph packages.



A Django site. rendered by a django application. hosted by webfaction.