交互式图形
library(leaflet)
leaflet() %>%
addTiles() %>%
addMarkers(lng=112.768,lat=31.852,popup="8888")
LTV <- read.csv("LTV.csv")
LTV.ts <- ts(LTV)
dygraph(LTV.ts,main="LTV forecast") %>%
dySeries("V1",label="LTV",strokeWidth = 2) %>%
dyOptions(colors = "black",fillGraph = FALSE,fillAlpha = 0.4) %>%
dyHighlight(highlightCircleSize = 5,
highlightSeriesBackgroundAlpha = 0.2,
hideOnMouseOut = FALSE) %>%
dyAxis("x", drawGrid = FALSE) %>%
dyAxis("y", label = "LTV(Life Time Value)") %>%
dyRangeSelector()
# DT包
library(DT)
datatable(iris)
datatable(iris,rownames = FALSE) # 不输出行号
# networkD3包
# 利用simpleNetwork函数绘制简单网络图
library(networkD3)
src <- 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)
simpleNetwork(networkData,zoom=T)
# 利用networkD3函数绘制力导向网络图
# 加载数据
data(MisLinks)
data(MisNodes)
# 画图
forceNetwork(Links = MisLinks, Nodes = MisNodes,
Source = "source", Target = "target",
Value = "value", NodeID = "name",
Group = "group", opacity = 0.8)
# pairsD3包
if(!require(pairsD3)) install.packages("pairsD3")
pairsD3(iris[,1:4],group = iris[,5],
labels = c("花萼长度","花萼宽度","花瓣长度","花瓣宽度","种类"))
# scatterD3包
if(!require(scatterD3)) install.packages("scatterD3")
mtcars$names <- rownames(mtcars)
scatterD3(data = mtcars, x = wt, y = mpg, lab = names,
col_var = cyl, symbol_var = am,
xlab = "Weight", ylab = "Mpg", col_lab = "Cylinders",
symbol_lab = "Manual transmission")
# wordcloud2包
if(!require(wordcloud2)) devtools::install_github("lchiffon/wordcloud2")
letterCloud(demoFreqC[1:200,], "R", fontFamily = "微软雅黑",
color = "random-light")
# timevis包
if(!require(timevis)) install.packages("timevis")
data <- data.frame(
id = 1:4,
content = c("事项一" , "事项二" ,"事项三", "事项四"),
start = c("2016-11-10", "2016-11-11", "2016-11-20", "2016-12-14 15:00:00"),
end = c(NA , NA, "2016-12-04", NA)
)
timevis(data)
# rpivotTable包
# devtools::install_github(c("ramnathv/htmlwidgets", "smartinsightsfromdata/rpivotTable"))
library(rpivotTable)
mtcars$vs <- factor(ifelse(mtcars$vs==0,"自动","手动"))
colnames(mtcars)[8] <- "传输"
rpivotTable(mtcars)
转载自:https://blog.csdn.net/u010380670/article/details/85028440