1. 首页
  2. 自学中心
  3. 软件
  4. R

R语言可视化与highchart

R语言可视化与highchart

晓哥、python哥;微信15523802291

2016年10月21日

认识highchart

  • Make your data come alive
  • Make it easy for developers to set up interactive charts in their web pages
  • 语法 hPlot(formula,data,type,group,size,title,subtitle,radius)其中type 主要包含 line;spline;scatter;bar;column;bubbom;pie;

散点图-分组

library(rCharts)hPlot(x = "Wr.Hnd", y = "NW.Hnd", data = MASS::survey, type = c("scatter"), group = "Clap", size = "Age")

1477106413-9556-QVFA4OJ938oTVxEaCaYArGouIZ7g

气泡图

library(rCharts)hPlot(x = "Wr.Hnd", y = "NW.Hnd", data = MASS::survey, type = c("bubble"),group = "Clap", size = "Age")

1477106413-9016-Cg3zOpgPth1ozmSpgKaumXecwPFA

折线图

library(rCharts)hPlot(x = "Wr.Hnd", y = "NW.Hnd", data = MASS::survey, type = c("line"), group = "Clap", size = "Age")

1477106413-2983-azuGMibpSCU8XKyYPibZ6iaENhmQ

条形图

library(rCharts)hPlot(x = "Wr.Hnd", y = "NW.Hnd", data = MASS::survey, type = c("bar"), group = "Clap", size = "Age")

1477106413-2763-MhamxlhqzAOBqTRU9ficQIRGKFmQ

条形图

library(rCharts)hPlot(x = "Wr.Hnd", y = "NW.Hnd", data = MASS::survey, type = c("column"), group = "Clap", size = "Age")

1477106413-3483-j16k6bSic3wy6ibsmoNQbrqOc56A

饼图

library(rCharts)hPlot(~Clap, data = MASS::survey, type = c("pie"))

1477106413-5974-ib6j5pkDLbZNiat3EIMtibkQMtdg

多图结合

hPlot(x = "Wr.Hnd", y = "NW.Hnd", data = MASS::survey, type = c("line", 
 ? ?"bubble", "scatter"), group = "Clap", size = "Age")

1477106414-5941-u8LGpUq8ZnibCRT2zLyeIQWkWtsA

更多

  • 热力图,type为heatmap
  • 仪表盘, type 为gauge
  • 箱线图:type为boxplot
  • 瀑布图: type 为waterfall
  • 漏斗图: type 为waterfall
  • 金字塔图 : type 为pyramid 此外,highchart还可以画3D图,更多详细内容请参考官网

介绍一下个人经常用的桑基图

library(networkD3)
URL <- paste0( ? ? ? ?"https://cdn.rawgit.com/christophergandrud/networkD3/", ? ? ? ?"master/JSONdata/energy.json")
Energy <- jsonlite::fromJSON(URL)# PlotsankeyNetwork(Links = Energy$links, Nodes = Energy$nodes, Source = "source", ? ? ? ? ? ? Target = "target", Value = "value", NodeID = "name", ? ? ? ? ? ? units = "TWh", fontSize = 12, nodeWidth = 30)

1477106414-8632-ctwhicibBq4jBbSHqMYtxy0rX6kQ

网络图

library(networkD3)# Create fake datasrc <- c("A", "A", "A", "A", ? ? ? ?"B", "B", "C", "C", "D")
target <- c("B", "C", "D", "J", ? ? ? ? ? ?"E", "F", "G", "H", "I")
networkData <- data.frame(src, target)# PlotsimpleNetwork(networkData)

1477106414-4341-9q9AbIrzCJo6T1iaG3n2268z1gAg

表格图

library(DT) datatable(iris)
1477106414-9487-xiczNszgGn0wIeErOajibqVuBNIA

原创文章,作者:xsmile,如若转载,请注明出处:http://www.17bigdata.com/r%e8%af%ad%e8%a8%80%e5%8f%af%e8%a7%86%e5%8c%96%e4%b8%8ehighchart/

联系我们

在线咨询:点击这里给我发消息

邮件:23683716@qq.com

跳至工具栏