Plotting Question

Hello all,

I'm a text-mode coder by nature. I have done some GUI stuff, but not really
graphing or plotting-related. The last time I touched graphics was using
Java2D about 5 years ago.

Perhaps your collective wisdom could save me from heading down too many wrong
paths, and help me to use this powerful library quickly and effectively?

Mine is a project of tracing a program flow. I'd like to be able to create a
graph with X number of related boxes (representing function calls), with
vertexes between them (representing calls from one to another).

Basically, I would like to be able to create objects of arbitrary type
(possibly just a string, but I'd like to have some flexibility if possible),
create relationships between the objects, and have a graph automagically
space them out on the given canvas so they are as clear as possible.

Beyond that, I'd like to be able to change the color of some or all of the
text in the boxes. This could be used for any number of things, but one
option would be to toggle the title between black and red to indicate that a
function was executed. That way not only do I get to see the related
subroutines, but I also get to see which was executed when.

So the first question is, am I in the wrong place? Is this outside the scope
of matplotlib? If so, is there another Python library I need to check out?

If I'm in the right place, which part of the vast matplotlib should I look at
first for these goals?

Thank you all in advance!

atlas wrote:

Mine is a project of tracing a program flow. I'd like to be able to create a graph with X number of related boxes (representing function calls), with vertexes between them (representing calls from one to another).

So the first question is, am I in the wrong place? Is this outside the scope of matplotlib? If so, is there another Python library I need to check out?

I don't' think mpl is the perfect tool for this kind of thing. You could probably make it work, but that's not what it's designed for. Do you have a GUI toolkit in mind?

If wxPython: FloatCanvas or OGL would probably work well.

If tkInter: The tk Canvas is very flexible, and I wouldn't be surprised if someone has written a tool on top of it to help with this sort of thing.

If GTK or QT: I have no idea, but I"d look -- I'll bet there is something.

If paper copy: check out ReportLab for pdf generating.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

Hi,

Mine is a project of tracing a program flow. I'd like to be able to create a
graph with X number of related boxes (representing function calls), with
vertexes between them (representing calls from one to another).

Basically, I would like to be able to create objects of arbitrary type
(possibly just a string, but I'd like to have some flexibility if possible),
create relationships between the objects, and have a graph automagically
space them out on the given canvas so they are as clear as possible.

You can look into NetworkX:
https://networkx.lanl.gov/wiki

It's probably not exactly what you're after, but it's a (rather well done) general purpose graph library for Python and has some canned facilities to draw resulting graphs to the screen (via matplotlib).

You can also save graphs in graphviz format for external processing via dot/graphviz, which is handy ...

Hope that helps,
-steve

It sounds like graphviz is the right tool for your application.

  http://www.graphviz.org

Ken

···

On Apr 23, 2007, at 5:16 PM, atlas wrote:

Basically, I would like to be able to create objects of arbitrary type
(possibly just a string, but I'd like to have some flexibility if possible),
create relationships between the objects, and have a graph automagically
space them out on the given canvas so they are as clear as possible.