0
点赞
收藏
分享

微信扫一扫

R语言 交互式绘图echarts4r包WebGL浅探

林塬 2022-05-03 阅读 64

地震
在这里插入图片描述

library(echarts4r)
quakes |> 
  e_charts(long) |> 
  e_geo(
    roam = TRUE,
    boundingCoords = list(
      c(185, - 10),
      c(165, -40)
    )
  ) |> 
  e_scatter_gl(lat, depth) |> 
  e_visual_map()

使用WebGL绘制更大的图
在这里插入图片描述

#Use graphGL for larger networks
nodes <- data.frame(
  name = paste0(LETTERS, 1:300),
  value = rnorm(300, 10, 2),
  size = rnorm(300, 10, 2),
  grp = rep(c("grp1", "grp2", "grp3"), 100),
  stringsAsFactors = FALSE
)

edges <- data.frame(
  source = sample(nodes$name, 400, replace = TRUE),
  target = sample(nodes$name, 400, replace = TRUE),
  stringsAsFactors = FALSE
)

e_charts() |> 
  e_graph_gl() |> 
  e_graph_nodes(nodes, name, value, size, grp) |> 
  e_graph_edges(edges, source, target)

参考资料:
https://echarts4r.john-coene.com/articles/gl.html

举报

相关推荐

0 条评论