The solution below is maybe not optimal, but it's something you can figure
out easily enough yourself. Also, I believe this question is better asked
on stackoverflow as it is not an actual matplotlib issue, but rather a
programming problem (that shows no effort).

Let me first redefine your matrices to comply with PEP8.

nodes = np.array([[1,2,3,4],[0, 5, 2, 8]])  # What you call Q. The first
node here is (1,0)
connections = np.triu(np.random.rand(4,4))  # What you call Z
connections[0,3] = 0  # Just to make the plot a little more clear.

for row,_ in enumerate(connections):
    for col in range(row+1, connections.shape[0]):
        if connections[row, col]:
            plt.plot(
                nodes[0,[row,col]], nodes[1,[row,col]],
                color='{}'.format(connections[row, col]))  # Uses
gray-scale color-coding
plt.plot(nodes[0,:], nodes[1,:], 'ko ')


2014-07-29 14:18 GMT+02:00 Josè Luis Mietta <joseluismie...@yahoo.com.ar>:

> Hi experts!
>
> I have:
>
> * a list of Q 'NODES'=[(x,y)_1,........, (x,y)_Q], where each element
> (x,y) represent the spatial position of the node in 2D Cartesian space.
> * a matrix 'H' with QxQ elements {H_k,l}.
> H_k,l=0 if nodes 'k' and 'l' aren't joined by a edge, and H_k,l = the length
> of the edge that connects these nodes.
> * a matrix 'Z' with QxQ elements {Z_k,l}.
> Z_k,l=0 if nodes 'k' and 'l' aren't joined by a edge, and Z_k,l =
> intensity_k,l (a intensity scale of the edge, 0<intensity<I-max) if these
> nodes are connected.
>
> I want to draw the nodes in their spatial position, connected by the
> edges, and use a color scale for the 'intensity'.
>
> How must I do that?
>
> Waiting for your answers.
>
> Thanks a lot!
>
> Best regards,
> José Luis
>
>
> ------------------------------------------------------------------------------
> Infragistics Professional
> Build stunning WinForms apps today!
> Reboot your WinForms applications with our WinForms controls.
> Build a bridge from your legacy apps to the future.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to