Learn R Programming

sendplot (version 4.0.0)

xy.send: INTERACTIVE SCATTERPLOT

Description

This function is a wrapper to sendplot that will create a single interactive scatterplot

Usage

xy.send(plot.call, 
        x.pos,
        y.pos,
        plot.extras = NA,
        mai.mat=NA, mai.prc=FALSE,
        xy.labels=NA,
        image.size="800x1100",
        spot.radius = 5,
        fname.root="Splot",
        dir="./",
        window.size = "800x1100", 
        ...)

Arguments

plot.call
character vector containing single plot call
x.pos
vector of x locations for interactive points
y.pos
vector of y locations for interactive points
plot.extras
List of additional plotting calls that should be executed for the plot.
mai.mat
1 x 4 matrix of values to be passed in for each plots par mai. n is equal to the length of plot.calls. If NA, uses default margins.
mai.prc
logical indicating if mai mat values are percentages or hard coded values. If mai.proc is T, indicates percentage.
xy.labels
list of matricies. All matricies should be of n x m where n is the length of xpos or ypos. This information is displayed in the interactive plot window
image.size
character indicating size of device.
spot.radius
radius of circle in pixels indicating area that will be interactive around the center of graphed points
fname.root
Base name to use for all files created.
dir
directory path to where files should be created. Default creates files in working directory
window.size
size of the html window
...
additional arguments to the makeImap function

Value

  • Creates a static and interactive scatterplot

Details

This function is a wrapper for the sendplot function to create a single interacive scatterplot. See initSplot, makeImap, and makeSplot for more information. Users are encouraged to read the package vignette which includes a detailed discussion of all function arguments as well as several useful examples.

References

http://www.onlamp.com/pub/a/onlamp/2007/07/05/writing-advanced-javascript.html

http://www.walterzorn.com/tooltip/tooltip_e.htm

See Also

initSplot, makeImap, makeSplot, imagesend, heatmap.send, sendplot-package, sendxy

Examples

Run this code
library(sendplot)
library(rtiff)


plot.call=c("plot(mtcars$hp,mtcars$mpg,xlab='gross horsepower',
                   ylab='miles per gallon',axes=FALSE,pch=mtcars$cyl,
                   col=mtcars$am+1,cex=0.875,
                   main='Motor Trend Car Road Tests')")

plot.extras=c("axis(1);axis(2);
              legend(200,25,pch=rep(c(4,6,8),2),col=c(rep(1,3),rep(2,3)),
                     legend=paste(rep(c(4,6,8),2),'cylinders,',
                              c('automatic','manual')[c(rep(1,3),rep(2,3))]),cex=0.875)")


#set up temporary directory
direct = paste(tempdir(),"/",sep="")
direct


xy.send(plot.call=plot.call,
       y.pos=mtcars$mpg,x.pos=mtcars$hp,
       xy.labels = data.frame(name=rownames(mtcars),mtcars=mtcars), 
       plot.extras=plot.extras,
       image.size="800x600",
       fname.root="exPlotXY", dir = direct, font.size=18)

Run the code above in your browser using DataLab