Examples:
zoomablePairsSVG("zoomablePairs.svg", state.x77)
#read in a 2 column csv file
budget <- read.csv("budget.csv")
# make an SVG plot using RSVGTipsDevice
devSVGTips("budget.svg", toolTipMode=0, title="2010 U.S. Budget", width=10, height=12)
par(mar=c(8,28,5,5))
barplot(budget$amount, names.arg = budget$expenditure, horiz=TRUE, las=1, cex.names=0.8, main="2010 U.S. Budget", sub="Mandatory (green), Discretionary (orange), in billion USD", col=c(rep("green", 6),rep("orange", 26)))
dev.off()
# make the rectangles clickable
clickableSVG(file.in="budget.svg", values=as.vector(budget$amount), clickable.element="rect", update="total", text.x=400, text.y=80)
# make some data: get PE ratios, and average every 5 years
pe <- read.csv("pe.csv")
pe <- pe[-1537]
ts <- ts(pe$P.E.Ratio, start=1881, frequency=12)
years <- seq(from=1880, to=2005, by=5)
averages <- sapply(years, function(x) mean(window(ts, x, x+5)))
# make an SVG plot using RSVGTipsDevice
devSVGTips("peratio.svg", height=4, width=6)
barplot(averages, names.arg=years, main="PE Ratios")
dev.off()
# make the rectangles clickable
clickableSVG("peratio.svg", clickable.element="rect", values=averages, update="mean", text.x=60, text.y=60)