Learn R Programming

caroline (version 0.6.6)

hyperplot: Annotate Outliers in a Scatterplot via an HTML Image-Map

Description

This simple function makes R scatter plots interactive by creating an image and wrapping HTML around it: creating a hyperlinked hyperplot. Hover over the points to see what each is. Click to connect to a table below that will tell you more about each point (if browse ==TRUE).

Usage

hyperplot(x, y=NULL, annout, name='hyperplot.image_map', w=72*8, h=72*6, link2tab=TRUE, browse=TRUE, cex=1, ...)

Arguments

x
a plot-able object, a numeric vector or the name of a numeric vector in annout.
y
a numeric vector or the name of a numeric vector in annout. Must be the same length as x.
annout
a named data.frame or table of outliers to annotate the points in the plot. 'x' and 'y' params can indicate column names or numbers of annout, but 'out' boolean column should exist as well.
name
base name of the image & html (map) page that get generated.
w
width of the png image in inches.
h
height of the png image in inches.
link2tab
create a linked lookup table from image to the annout table.
browse
load the html page automatically via R.
cex
character expansion for points
...
other paramters passed on to plot()

Value

  • HTML page with annotation mapped image

See Also

imagemap(imagemap),imageMap(Rgraphviz),browseURL

Examples

Run this code
if(capabilities()["png"] && interactive()) {


## x and y as numeric vectors
x <- nv(rnorm(30),1:30)
y <- rnorm(30)
hyperplot(x,y, annout=1:15)

## annout as dataframe (x and y as vectors)
df <- data.frame(out=rep(c(TRUE,FALSE),15),row.names=as.character(1:30))
hyperplot(x,y, annout=df)


## x and y as names of columns in df
df <- data.frame(x=x, y=y, out=rep(c(TRUE,FALSE),15),row.names=as.character(1:30))
hyperplot(x='x',y='y', annout=df)


}

Run the code above in your browser using DataLab