我有一些看起来像这样的测试数据:
library(rbokeh)
library(lattice)
Date<-as.Date(c("2017-01-01","2017-01-01","2017-01-01","2017-01-02","2017-01-02","2017-01-02","2017-01-03","2017-01-03","2017-01-03","2017-01-4","2017-01-4","2017-01-4"))
Date<-as.POSIXct(Date)
Y<-c(1,2,3,1,2,3,1,2,3,1,2,3)
Temp<-c(20,23,25,19,20,21,18,19,20,13,17,19)
DF<-data.frame(Date,Y,Temp)
我使用像这样的晶格水平图将其可视化:
dev.new(width=15, height=6)
levelplot(Temp ~ Date * Y, data = DF,ylim=c(3,1),
xlab = "TimeStamp", ylab = "Temp",
main = "Test", aspect=0.4,
col.regions =colorRampPalette(c('blue','red')),at=seq(13, 25, length.out=120))
我已经开始使用rbokeh来创建交互式绘图,以便放大x(日期)轴的各个方面以进行基本数据浏览。但是我找不到一种为这种水平图创建类似的rbokeh-ish图的方法。有没有办法让rbokeh创建一个水平图,或者如果没有的话,可以创建其他库吗?
答案 0 :(得分:1)
devtools::install_github("JohnCoene/echarts4r")
library(echarts4r)
DF %>%
dplyr::mutate(Date = as.Date(Date)) %>%
e_charts(Date) %>%
e_heatmap(Y, Temp) %>%
e_visual_map(Temp)