【问题标题】:Interactive filtering and data visualisation交互式过滤和数据可视化
【发布时间】:2017-05-08 08:43:29
【问题描述】:

如果是 mtcars 数据集,如何根据 cyl 的选择交互式填充点/标记。我的代码不起作用

mtcars%>%ggvis(~mpg,~disp)%>%filter(cyl %in% input_select(c("4","6","8"),selected="4",map=as.numeric))%>%layer_points()

【问题讨论】:

    标签: r ggvis


    【解决方案1】:

    确保 dplyr 已加载,并且您当前需要在 input_select 周围使用 eval,如图所示 here

    library(ggvis)
    library(dplyr)
    
    mtcars %>% 
        ggvis(~mpg, ~disp) %>% 
        filter(cyl %in% eval(input_select(c("4", "6", "8"), selected = "4"))) %>% 
        layer_points()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-02-09
      • 2020-12-15
      • 1970-01-01
      • 2012-01-19
      • 2017-01-02
      • 1970-01-01
      • 2011-05-06
      • 2022-07-01
      相关资源
      最近更新 更多