>>>>> "Omar" == Omar Kilani <[EMAIL PROTECTED]> writes:
Omar> Hello, I was wondering if anyone knew of any
Omar> charting/graphing code that worked with PyGTK 2 (utilising
Omar> DrawingArea perhaps?)
I've written a pure python 2D plotting lib in pygtk for Numeric
arrays. It has a matlab style functional interface to the object
oriented library, and supports almost all of the matlab 2D plotting
format string arguments, like
>>> plot(x, y, 'bo', x1, y1, 'r--')
which would plot x vs y with blue circles and x1 vs y1 with a red
dashed line.
It also has a few nice features
-- nice navigation support, with x and y pan and zoom using the
wheel mouse.
-- I've paid fair attention to efficiency in the plotting code
because I have to deal with large data sets; all the crunchy bits
are done in Numeric.
-- I've spent a lot of energy trying to make the plots look good, by
trying to emulate matlab plots in look and feel and intelligently
choosing the default tick marks so you don't have ticks and
labels at 3.987 when 4.0 would do just as well.
-- You can have multiple axes per figure with subplot.
I haven't released it because it is incompletely documented and I
still have a long list of TODO features. But there is some demo code
and much of the library has help strings, I'd be happy to pass it your
way.
The downside: right now I have only 2D line and symbol graphs (eg
scatter plots), though bar graphs and the like will be easy to add.
And it requires pygtk2 and python 2.2+. I've tested it on linux and
win32.
Here are a couple of screenshots
# Two subplots
http://nitace.bsd.uchicago.edu:8080/summer/2003_01_27_215559_shot.png
# Some financial data, with navigation and measurement tools
http://nitace.bsd.uchicago.edu:8080/summer/2003_01_27_215904_shot.png
Here's the demo code for the first example:
from matplotlib.matlab import *
from Numeric import arange, sin, exp, multiply, pi
def f(t):
s1 = sin(2*pi*t)
e1 = exp(-t)
return multiply(s1,e1)
t1 = arange(0.0, 5.0, 0.1)
t2 = arange(0.0, 5.0, 0.02)
t3 = arange(0.0, 2.0, 0.01)
subplot(211)
plot(t1, f(t1), 'bo', t2, f(t2), 'k')
title('A tale of 2 subplots')
subplot(212)
plot(t3, sin(2*pi*t3), 'r--')
xlabel('time (s)')
show()
Cheers,
John Hunter
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/