Load Library
library(sendplot)

Set up data
mat = matrix(c(rep(c(rep(4,8),rep(0,5)),2),
                         rep(c(rep(1,8),rep(3,5)),6),
                         rep(c(rep(2,8),rep(3,5)),4)),
                         byrow=T, ncol=13)
mai.mat = matrix(.5,ncol=4,nrow=4)
myX = c(-1,-10,1,10,-5,0)
plot.calls = c("boxplot(count ~ spray, data = InsectSprays, col = 'lightgray')",
                      "plot(1:3,1:3, col='blue', xlab='', ylab=''); points(1:2, 2:3, col='red')",
                      "image(1:2,1:3, z=matrix(myX,ncol=3,nrow=2), xlab='', ylab='')",
                      "plot(cos, xlim = c(-pi,3*pi), n = 1001, col = 'blue', xlab='', ylab='')" )
plt.extras = list(figure1= "rect(xleft=c(3,1), ytop=c(25,5),xright=c(4,2), ybottom=c(20,0));title(main='A', cex=3)",
                        figure2="polygon(x=c(2,2.5,3,2.5), y=c(1,2.5,1,1.5));title(main='B', cex=3)",
                        figure3 ="title(main='C', cex=3)",
                        figure4="title(main='D', cex=3)")

Initialize Splot Object
Splot = initSplot(mat, plot.calls, mai.mat = mai.mat,plot.extras =plt.extras)

Optional 'first look'
Splot = makeSplot(Splot, fname.root="sendPlotEx", makeInteractive=FALSE, getLims=TRUE)

Now add tool-tip data
FIGURE 1
add information for boxplots
xvec = 1:6
yvec = Splot$plot.output[[1]]$stats[3,]
x.lbls = as.data.frame(matrix(c("boxplot.point1","boxplot.point2","boxplot.point3","boxplot.point4","boxplot.point5","boxplot.point6",
                                                  as.character(yvec),
                                                  "not a link", "not a link", "im a link", "im a link", "not a link", "not a link"),
                                              ncol=3))
names(x.lbls) = c("x.Label.1","x.Label.2", "asLinks")
asLinks = c(NA, NA, "code.html/interactiveFigure1.html", "code.html/interactiveFigure1.html", NA, NA)
x.links = as.data.frame(matrix(rep(NA, 18), nrow=6))
x.links[,1] = "code.html/codeFigure1.html, code.html/initializeObject.html"
x.links[,2] = "code.html/boxplot.interactive.html, code.html/interactiveFigure1.html"
x.links[,3] = "code.html/completeCode.html"
names(x.links) = c("code", "interactive", "completeCode")

Splot = makeImap(Splot, figure=1, xy.type="points", x.pos=xvec, y.pos=yvec, x.labels = x.lbls, asLinks = asLinks,
                               fname.root="sendPlotEx", spot.radius=25)

add information for one of the outlier points
x.links = as.data.frame(matrix(rep(NA, 3), nrow=1))
x.links[,1] = "code.html/codeFigure1.html, code.html/initializeObject.html"
x.links[,2] = "code.html/point.interactive.html, code.html/interactiveFigure1.html"
x.links[,3] = "code.html/completeCode.html"
names(x.links) = c("code", "interactive", "completeCode")

Splot = makeImap(Splot, figure=1, xy.type="circle", x.pos=3, y.pos=7,
                               x.labels = list(Xlabel1.xyType="point", Xlabel2.asLinks="im a link"),
                               y.labels = list(ylabel1.yValue="7", tooltip.font="arial",tooltip.size="20",
                                                      tooltip.fontcolor="hotpink",tooltip.background="blue"),
                               asLinks = "code.html/interactiveFigure1.html", fname.root="sendPlotEx", spot.radius=20, x.links=x.links,
                               font.type="arial", font.size="20", font.color="hotpink", bg.color="blue")

add information for rectangles
x.links = as.data.frame(matrix(rep(NA, 6), nrow=2))
x.links[,1] = "code.html/codeFigure1.html, code.html/initializeObject.html"
x.links[,2] = "code.html/rectangle.interactive.html, code.html/interactiveFigure1.html"
x.links[,3] = "code.html/completeCodeFigure1.html, code.html/completeCode.html"
names(x.links) = c("code", "interactive", "completeCode")

Splot = makeImap(Splot, figure=1, xy.type="rect",
                               x.pos=c(3,1), y.pos=c(25,5),x.right.pos=c(4,2), y.bottom.pos=c(20,0),
                               x.labels = as.data.frame(list(Xlabel.1=c("rect.1","rect.2"),
                                                                           Xlabel.2.coordinates=c("3,20-3,25-4,25-4,20","1,0-1,5-2,5-2,0"),
                                                                           asLinks=c("im a link", "im a link"))),
                               y.labels = list(tooltip.size=c("8","8"), tooltip.fontcolor=c("cyan","cyan"), tooltip.background=c("black","black")),
                               asLinks = "http://www.buffalo.edu", fname.root="sendPlotEx", spot.radius=10, x.links=x.links,
                               font.size=8, font.color="cyan", bg.color="black")
FIGURE 2
add information for set of three data points
x.lbls = as.data.frame(list(xLabel1:xyType=c("point1", "point2", "points3"), xLabel1:asLinks=c("im a link", "im a link", "im a link"))
y.links = as.data.frame(matrix(rep(NA, 9), nrow=3))
y.links[,1] = "code.html/codeFigure2.html, code.html/initializeObject.html"
y.links[,2] = "code.html/threepoints.interactive.html, code.html/interactiveFigure2.html"
y.links[,3] = "code.html/completeCodeFigure2.html, code.html/completeCode.html"
asLinks=c("code.html/completeCodeFigure2.html","code.html/completeCodeFigure2.html","code.html/completeCodeFigure2.html")

Splot = makeImap(Splot, figure=2, xy.type="circle", x.pos=1:3, y.pos=1:3,
                               y.labels = list(tooltip.fontcolor=c("green", "green", "green"),tooltip.size=c("14", "14", "14"),
                                                      tooltip.background=c("transparent", "transparent", "transparent")),
                               asLinks = asLinks, x.labels = x.lbls, fname.root="sendPlotEx", y.links=y.links,
                               bb.cex=5, spot.radius=20, font.color="green",bg.color="", font.size="14" )

add information for set of two data points
y.lbls = as.data.frame(list(xLabel1.xyType=c("point1", "point2"), xLabel1.asLinks=c("im not a link", "im not a link")))
y.links = as.data.frame(matrix(rep(NA, 6), nrow=2))
y.links[,1] = "code.html/codeFigure2.html, code.html/initializeObject.html"
y.links[,2] = "code.html/twopoints.interactive.html, code.html/interactiveFigure2.html"
y.links[,3] = "code.html/completeCodeFigure2.html, code.html/completeCode.html"

Splot = makeImap(Splot, figure=2, xy.type="circle", x.pos=1:2, y.pos=2:3,
                               x.labels = list(tooltip=c("default settings", "default settings")),
                               y.labels = y.lbls, fname.root="sendPlotEx", y.links=y.links,
                               bb.cex=5,spot.radius=15)

add information for polygon
x.links = as.data.frame(matrix(rep(NA, 3), nrow=1))
x.links[,1] = "code.html/codeFigure2.html, code.html/initializeObject.html"
x.links[,2] = "code.html/polygon.interactive.html, code.html/interactiveFigure2.html"
x.links[,3] = "code.html/completeCodeFigure2.html, code.html/completeCode.html"
names(x.links) = c("code", "interactive", "completeCode")

Splot = makeImap(Splot, figure=2, xy.type="polygon", x.pos=c(2,2.5,3,2.5), y.pos=c(1,2.5,1,1.5),
                               x.labels = as.data.frame(list(xLabel.xyType = "Polygon")), asLinks="code.html/interactiveFigure2.html",
                               x.links=x.links,fname.root="exToy", bb.cex=5,
                               y.labels = as.data.frame(list(yLabel1.asLinks="Im a link", tooltip.fonttype="san-serif",
                                                                            tooltip.fontsize="30",tooltip.fontcolor="purple" )),
                               font.size=30, font.type="sans-serif", font.color="purple")

FIGURE 3
add information for image
x.lbls=as.data.frame(list(xLabels.xy.type= c("image.box", "image.box"), xLabels.1 = c("X.1", "X.2")))
y.lbls=as.data.frame(list(y.Lables = c("Y.1", "Y.2", "Y.3")))
xy.lbls=list(XY.label = matrix(c("image.box1","image.box2", "image.box3","image.box4","image.box5","image.box6"),ncol=2))
x.links=as.data.frame(list(X.links.1 = c("http://www.buffalo.edu, http://bioinformatics.buffalo.edu", NA)))
y.links=as.data.frame(list(Y.links.1 = c(NA, "http//www.buffalo.edu", NA)))
xy.links=list(XY.link.code = matrix(rep("code.html/codeFigure3.html, code.html/initializeObject.html",6), ncol=2),
                     XY.link.interactive = matrix(rep("code.html/image.interactive.html, code.html/interactiveFigure3.html",6), ncol=2),
                     XY.link.completeCode = matrix(rep("code.html/completeCodeFigure3.html, code.html/completeCode.html",6), ncol=2))

Splot = makeImap(Splot, figure=3, xy.type="image.box", x.pos= c(.5,1.5,2.5), y.pos=c(.5,1.5,2.5,3.5),
                              x.labels = x.lbls, y.labels = y.lbls, xy.labels=xy.lbls,
                              x.links=x.links, y.links=y.links, xy.links=xy.links,
                              fname.root="sendPlotEx", bb.cex=5, spot.radius=10)

DEFAULT REGION
adds default region for image
Splot = addDefault(Splot,
                               data=c("", "quick", "convenient", "highly customizable", "This is a default region","arial", "gray", "yellow" ),
                               data.labels=c("Sendplot selling points", " 1", " 2", " 3", "type","tooltip.font",
                                                     "tooltip.backgroundColor","tooltip.fontColor"),
                               links=c("code.html/completeCode.html", "code.html/Default.html"),
                               links.labels=c("CompleteCode", "Default.code"),
                               font.size=10, font.type="arial", bg.color="gray", font.color="yellow")
                              
Now make HTML
Splot = makeSplot(Splot, fname.root="sendPlotEx", returnObj=TRUE)