Creating Dynamic Graphs.

If you want to use technique with bar, hist, or scatter

    > (which return Patch instances), you'll have to wait a few
    > minutes while I update the code, because I haven't added a
    > set data method for those classes.

I added some features to CVS to make this work with patches and do
allow the updates to occur flicker free. Below is an simulated
example that uses a bar chart to show network, CPU and memory usage,
updating 4 times per second. If you have trouble with CVS or want a
windows installer of the updated code, let me know

John Hunter

[ I'm reposting this because it didn't seem to get through yesterday.
If this is a duplicate sorry ]

import pygtk
import gtk
import time
from matplotlib.matlab import *

def get_memory():
    "Simulate a function that returns system memory"
    return 100*(1+sin(0.5*pi*time.time()))

def get_cpu():
    "Simulate a function that returns cpu usage"
    return 100*(1+sin(0.2*pi*(time.time()-0.25)))

def get_net():
    "Simulate a function that returns network bandwidth"
    return 100*(1+sin(0.7*pi*(time.time()-0.1)))

def get_stats():
    return get_memory(), get_cpu(), get_net()

fig = figure(1)
ax = subplot(111)
ind = arange(1,4)
pm, pc, pn = bar(ind, get_stats())
centers = ind + 0.5*pm.get_width()
ax.set_xticklabels(['Memory', 'CPU', 'Bandwidth'])
ax.set_ylabel('Percent usage')
ax.set_title('System Monitor')

def updatefig(*args):
    m,c,n = get_stats()

    return gtk.TRUE

gtk.timeout_add(250, updatefig)
John Hunter