2D交互散点图

13 篇文章 0 订阅

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
    )
  )
)

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值