回复:Re: [wxPython-users] graph visualization implementation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

回复:Re: [wxPython-users] graph visualization implementation

imagepy
Hi:
yes, embed a matplotlib canvas is the best way. you can use plot with '-' style to draw the arc, and with 'o' style to draw the node. every element in matplot can set a pick parameter. you can bind a method. you can get the graphic feature you clicked, then use a dict to store the <feature, node>.
if you donot like using matplotlib, you must use dc to draw the graph, and treat the mouse event to analysis which node you clicked! If you want to treat these events yourself, shapely can help.

best
YXDragon
----- 原始邮件 -----
发件人:Chris Barker <[hidden email]>
收件人:wxpython-users <[hidden email]>
主题:Re: [wxPython-users] graph visualization implementation
日期:2017年07月08日 03点24分

On Fri, Jul 7, 2017 at 12:17 PM, Chris Barker <[hidden email]> wrote:
The "trick" is that you'll need to figure out the layout yourself -- i.e. where to put the boxes so they don't overlap, etc, etc.... maybe networkx can help with that?

I just took a quick look at networkx -- it provides some support for drawing graphs using matplotlib.

So you could embedd an MPL graph in your wx app, though it may be hard to get teh clicking behaviour you want.

Unfortunately, it looks like they used the non-OO interface to MPL, so if you want to draw to an embedded graph, and/or want to access the layout info without actually using MPL, you'll need to go into the source and extract what you need :-( I haven't looked to see how well structured it is in side -- could be easy or hard, depending.

-CHB


 
-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            <a target="_blank" href="tel:(206)%20526-6959" value="+12065266959">(206) 526-6959   voice
7600 Sand Point Way NE   <a target="_blank" href="tel:(206)%20526-6329" value="+12065266329">(206) 526-6329   fax
Seattle, WA  98115       <a target="_blank" href="tel:(206)%20526-6317" value="+12065266317">(206) 526-6317   main reception

[hidden email]



--

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

[hidden email]

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.