[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Anybody ever use igraph to create regression path diagrams?
From: |
Gábor Csárdi |
Subject: |
Re: [igraph] Anybody ever use igraph to create regression path diagrams? |
Date: |
Tue, 17 Jul 2012 14:53:50 -0400 |
I agree. tkplot() is very much just an experiment, a not very
successful one, as I wasn't satisfied with Tk.
igraph might get proper interactive plotting in the future, but only
if someone implements a nice modern cross-platform R package for
developing GUIs.
Best,
Gabor
On Mon, Jul 16, 2012 at 6:53 PM, Bernie Hogan <address@hidden> wrote:
> With all due respect to the igraph team, I think this is a pretty cumbersome
> process for igraph. If you get your coefficients in some sort of igraph
> object you can be a lot more flexible in NodeXL (on windows) or gephi. NodeXL
> is probably the best way to customise a graph to taste with pointing and
> clicking. Just write the igraph object to graphml. As for storing the
> arrangement - save the graphml and it should preserve the xy coordinates.
>
> But if you are a tk hacker by all means try out tamas's suggestions!
>
> Bernie
>
> Sent from my iPhone
>
> On 16 Jul 2012, at 23:26, Tamás Nepusz <address@hidden> wrote:
>
>> Dear Prof. Johnson,
>>
>> I'm not the developer of the R interface but I thought I'd answer anyway and
>> let Gabor correct or extend what I say.
>>
>>> 1. I need to have relatively complicated R objects that are
>>> represented by the igraph nodes. For example, a variable may be it
>>> 'ordinary' format X, or it may be log(x), or poly(x,d), or so forth.
>>> I'm thinking of still calling it X in the graph, but there would be
>>> some right-click magic to allow the user to ask for transformations.
>>> Is it feasible to add more variables inside a node object. Possible?
>>> Can you point me at the right starting point or example?
>>
>> Internally, igraph treats the nodes as integers, but it allows you to attach
>> arbitrary R objects as attributes to the nodes (and also to the edges). So,
>> you can probably store all the extra information you need in an
>> appropriately constructed R data type and then attach this to the node as a
>> "data" attribute or something like that. For instance, suppose that you want
>> to store the "type" of a node and the type is one of "ordinary", "log" or
>> "exp". You can then do something like this:
>>
>> V(g)$type <- "ordinary" # assigns "ordinary" to the type of each
>> node
>> V(g)[2]$type <- "exp" # sets the type of node 2 to "exp"
>> V(g)$type # returns the types of each vertex
>>
>> As for the right-click magic: tkplot does not allow the customization of the
>> vertex popup menu yet, but it is probably not too difficult by taking the
>> source code of tkplot() as a template, copying it, and then modifying it as
>> needed (look for the lines starting with tkadd(vertex.popup.menu…)).
>>
>>> 2. Suppose a graph exists, and I view and re-arrange it with tkrplot.
>>>
>>> Is there a way to make the re-arranged objects take notice of the
>>> changes so that they are recorded permanently.
>>
>> Again, this can be achieved by modifying the tkplot() function. tkplot()
>> attaches event handlers to several mouse events of the drawing canvas; for
>> instance, the line starting with tkitembind(canvas, tobind, "<B1-Motion>",
>> …) attaches an event handler to the "<B1-Motion>" event, which is fired when
>> the user moves the mouse while button 1 of the mouse is pressed. This
>> corresponds to moving the selected vertices. Adding your own code into the
>> body of the event handler function allows you to respond to the
>> re-arrangement of the nodes.
>>
>> Note that tkplot() does not support adding new vertices/edges or removing
>> existing ones (as far as I know), so if the re-arrangements you wish to
>> perform on the graphical representation of the models includes
>> adding/removing vertices or edges, then this definitely needs more coding.
>>
>> All the best,
>> Tamas
>>
>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help
--
Gabor Csardi <address@hidden> MTA KFKI RMKI