rggobi: How to associate a GTK signal with the point that triggered it

12 views
Skip to first unread message

Jeff Marcus

unread,
Jun 17, 2014, 5:16:59 PM6/17/14
to gg...@googlegroups.com
I'd like to be able to click on a point in a ggobi plot and perform a custom action. My first attempt (based on the results from this search) where my custom action is to print the row for the data frame I've identified: 

gg <- ggobi(my.data.frame)
 gSignalConnect(gg, "identify-point",
    function(ggobi.plot, plot, id, dataset) {
      print(dataset[,id+1])
   }
}

Now when I identify a point by mousing over it,  the custom action occurs. The problem is that identification is that while I'm dragging the mouse many points are selected. I'd like the selection to occur only when I click on the point. I then tried connecting to the "sticky-point-added" signal, which seems to only be triggered by a mouse click. However, I had to rewrite the function above to make things work:

gg <- ggobi(my.data.frame)
gSignalConnect(gg, "sticky-point-added", 
    function(ggobi.plot, id, ignore, dataset) {
      print(dataset[,id+1])
   }
}

Note that the callback function has a different set of arguments. I figured this out by trial and error, using the gSignalGetInfo() function. 

My question:

(*) How can one definitively find out what arguments should be provided with the callback function and what they mean. 

 Thx. 

 Jeff


Jeff Marcus

unread,
Jun 17, 2014, 8:00:10 PM6/17/14
to Michael Lawrence, GGobi users
Michael:
  Thanks for the quick response (and moreover for RGtk2)  I actually did that for the sticky-point-added signal and got the following:

> gSignalGetInfo(sigs$'sticky-point-added')
$returnType
GType identifier for 'void'

$signal
sticky-point-added 
               156 
attr(,"class")
[1] "GSignalId"

$parameters
$parameters[[1]]
GType identifier for 'gint'

$parameters[[2]]
GType identifier for 'gint'

$parameters[[3]]
GType identifier for 'GGobiData'


$objectType
GType identifier for 'GGobi'

$runFlags
[1] 34


My problem is that I see two parameters of type gint but didn't know what they represented. After some  trial and error I figured out that the id was the first integer. I still don't know what the second integer is. Is there some convention or some documentation to find out what the parameters actually represent? Thanks. 

 Jeff


On Tue, Jun 17, 2014 at 5:34 PM, Michael Lawrence <lawrence...@gene.com> wrote:
You could do this using RGtk2:

> signals <- gObjectGetSignals(gg)
> names(signals)
 [1] "datad-added"           "brush-motion" "move-point"          
 [4] "identify-point"        "select-variable"                  "splot-new"           
 [7] "variable-added"
     "variable-list-changed" "sticky-point-added"  
[10] "sticky-point-removed"  "clusters-changed"      "display-new"         
[13] "display-selected"    
> gSignalGetInfo(signals$"identify-point")
$returnType
GType identifier for 'void'

$signal
identify-point
            89
attr(,"class")
[1] "GSignalId"

$parameters
$parameters[[1]]
GType identifier for 'GGobiSPlot'

$parameters[[2]]
GType identifier for 'gint'

$parameters[[3]]
GType identifier for 'GGobiData'


$objectType
GType identifier for 'GGobi'

$runFlags
[1] 34




--
You received this message because you are subscribed to the Google Groups "GGobi users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggobi+un...@googlegroups.com.

To post to this group, send email to gg...@googlegroups.com.
Visit this group at http://groups.google.com/group/ggobi.
For more options, visit https://groups.google.com/d/optout.


Reply all
Reply to author
Forward
0 new messages