Description Usage Arguments Details Value Note Author(s) References See Also Examples
This function is a wrapper to sendplot that will create a single interactive image
1 2 3 4 5 6 7 8 9 10 11 12 13 |
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 |
xy.type |
Indication of how the xpos and ypos values should be treated.Current options are "image.midpoint","image.boundaries", or "image.box".See details or vignette. |
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 y and m is the length of x when xy.type is "image.midpoint". All matricies should be of n x m where n is the length of y -1 and m is the length of x - 1 when xy.type is "image.boundaries" or "image.box". 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 |
This function is a wrapper for the sendplot function to create a
single interacive image. 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.
Creates a static and interactive image
The interactive html plot currently only works in web browsers that implement java script.
The code used to create the javascript embedded in html file is a modified version of the javascript code or from the open source tooltip library. see reference links
Lori A. Shepherd, Daniel P. Gaile
http://www.onlamp.com/pub/a/onlamp/2007/07/05/writing-advanced-javascript.html
http://www.walterzorn.com/tooltip/tooltip\_e.htm
initSplot
, makeImap
,
makeSplot
, sendplot-package
, sendimage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | library(sendplot)
library(rtiff)
library(stats)
mai.mat = matrix(c(1,1,1,1), ncol=4)
carsX = as.matrix(mtcars)
carsX <- sweep(carsX, 2, colMeans(carsX, na.rm = TRUE))
sx <- apply(X=carsX, MARGIN=2, FUN="sd", na.rm = TRUE)
carsX <- sweep(carsX, 2, sx, "/")
plot.call="image(x=1:dim(carsX)[2],y=1:dim(carsX)[1], z=t(carsX),axes =
FALSE, xlab = '', ylab = '');axis(1,1:dim(carsX)[2],
labels=colnames(carsX),las = 2, line = -0.5, tick = 0,cex.axis =.8);
axis(4,1:dim(carsX)[1], labels=rownames(carsX),las = 2, line = -0.5,
tick = 0,cex.axis =.65)"
xy.labels=list(value=round(carsX,3))
x.labels=data.frame(label=colnames(carsX),
description=c("Miles/(US) gallon","Number of cylinders",
"Displacement (cu.in.)",
"Gross horsepower",
"Rear axle ratio",
"Weight (lb/1000)",
"1/4 mile time",
"V/S",
"Transmission (0 = automatic, 1 = manual)",
"Number of forward gears",
"Number of carburetors")
)
#set up temporary directory
direct = paste(tempdir(),"/",sep="")
direct
imagesend(plot.call=plot.call,
x.pos= 1:dim(carsX)[2],
y.pos= 1:dim(carsX)[1],
xy.type = "image.midpoints",
xy.labels=xy.labels,
spot.radius = 5,
fname.root="manImage", dir=direct,
window.size = "800x1100",
x.labels=x.labels, mai.mat=mai.mat)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.