Skip to content

Using interactive plots to get information about data points

4 messages · Michael Bibo, jcarmichael

#
I have been experimenting with interactive packages such iplots and playwith. 
Consider the following sample dataset:

A  B  C  D
1  5  5  9
3  2  8  4
1  7  3  0
7  2  2  6

Let's say I make a plot of variable A.  I would like to be able to click on
a data point (e.g. 3) and have a pop-up window tell me the corresponding
value for variable D (e.g. 4).  I am also trying to produce multiple small
plots.  For example, four side-by-side boxplots for each of the four
variables A, B, C, D.

Any help would be greatly appreciated!  Thanks!
#
jcarmichael <jcarmichael314 <at> gmail.com> writes:
?identify with labels argument.

Another approach you might like to consider is to use GGobi (www.ggobi.org) with
the rggobi package linking directly to it from R.  GGobi is built specifically
for this kind of interactive purpose.
?par... eg par(mfrow=c(1,4)) (for base graphics).


Hope this helps.

Michael Bibo
Queensland Health
2 days later
#
Thank you for the GGobi reference, it is a very handy tool!  My main goal,
however, is to be able to identify univariate outliers (with boxplots for
example), and I'm having a hard time getting the rggobi package to do that.
Michael Bibo-2 wrote:

  
    
#
jcarmichael <jcarmichael314 <at> gmail.com> writes:
Hmmm...  I guess because GGobi is designed for the "visualization of
high-dimensional data", boxplots of individual vectors isn't a priority.  Sorry
if that was a bad lead. (Still cool software, though!)

You can, however, use identify.  An RSiteSearch for "identify boxplot" will give
you a number of leads.  

I often recommend John Fox's R Commander GUI as a tool to help with learning
syntax.  In this case, the Rcmdr dialogue for boxplots includes a checkbox for
"identify outliers with mouse".  You can use this dialogue with this option
checked, and then examine the syntax to see how it was done:   
 
data(Angell, package="car")
boxplot(Angell$hetero, ylab="hetero")
identify(rep(1, length(Angell$hetero)), Angell$hetero, rownames(Angell))

The results of the RSiteSearch will explain how/why this works. (Hint: the
"rep(1,length(z)),z" pattern essentially defines x,y coordinates of all the
points that make up the boxplot - for a univariate boxplot, all have an 'x'
coordinate of 1). 

In a similar vein, the latticist GUI (package playWith - need GTK libraries or
runtime (windows) installed) has similar functionality with parallel boxplots.

Hope this helps.

Michael Bibo
Queensland Health