2D交互散点图
https://www.canvasxpress.org/index.html
library(canvasXpress)
vals = c(6.47,4.03,
6.13,3.76,
6.19,3.77,
4.89,3.34,
5.63,3.47,
4.52,2.92,
5.89,3.2,
4.79,2.71,
3.53,3.53,
6.08,4.51,
4.02,4.56)
vars = c("North",
"Yorkshire",
"Northeast",
"East Midlands",
"West Midlands",
"East Anglia",
"Southeast",
"Southwest",
"Wales",
"Scotland",
"Northern Ireland")
smps = c("Alcohol",
"Tobacco")
data = as.data.frame(matrix(vals, nrow = 11, ncol = 2, byrow = TRUE, dimnames = list(vars, smps)))
valx = c("Average weekly household spending on alcoholic beverages in pounds",
"Average weekly household spending on tobacco products in pounds")
varx = c("Description")
datx = as.data.frame(matrix(valx, nrow = 1, ncol = 2, byrow = TRUE, dimnames = list(varx, smps)))
canvasXpress(
data = data,
smpAnnot = datx,
decorations = list(
marker = list(
list(
y = 0.18,
text = "Maybe an Outlier",
sample = list("Alcohol","Tobacco"),
variable = "Northern Ireland",
x = 0.45,
line = list(174,99,228.51200439453123,145.482),
textLength = 122.5634765625,
textHeight = 15,
line2 = list(228.51200439453123,137.982,228.51200439453123,152.982),
render = 65,
id = "scatter2d1-marker-0",
color = "rgb(0,0,0)",
align = "center",
baseline = "middle",
width = 1,
curX = 295.92191650390623,
curY = 145.482,
tx = 295.92191650390623,
ty = 145.482
)
)
),
graphType = "Scatter2D",
showTransition = FALSE,
theme = "CanvasXpress",
title = "2D plot",
xAxis = list("Alcohol"),
yAxis = list("Tobacco"),
graphOrientation = "horizontal",
afterRender = list(
list(
"setDimensions",
list(609,609,TRUE)
),
list(
"drawRangesAfterWheelEvent",
list(NULL,NULL,NULL,NULL,0),
list(),
1662626335299
)
)
)