简体   繁体   English

创建交互式水平图(热图)

[英]Create an interactive level plot (heatmap)

I have some test data that looks like this: 我有一些看起来像这样的测试数据:

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)

I visualize it using lattice levelplot like this: 我使用像这样的晶格水平图将其可视化:

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

I have started using rbokeh to create interactive plots in order to zoom in on various aspects of the x (date) axis for basic data exploration. 我已经开始使用rbokeh来创建交互式绘图,以便放大x(日期)轴的各个方面以进行基本数据浏览。 But I cant find a way to create a similar kind of rbokeh-ish plot for this kind of levelplot. 但是我找不到一种为这种水平图创建类似的rbokeh-ish图的方法。 Is there a way to have rbokeh create a levelplot, or if not someother library that can? 有没有办法让rbokeh创建一个水平图,或者如果没有的话,可以创建其他库吗?

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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM