【发布时间】:2014-06-30 15:08:37
【问题描述】:
我正在尝试将tooltip 添加到我的 ggvis 图中。当我将鼠标悬停在密度图上时,我基本上想添加密度数。这就是我现在拥有的:
mtcars %>% ggvis(~wt, fill := "red") %>%
layer_densities() %>%
add_axis("x", title = "Weight") %>%
scale_numeric("x", domain = c(0, 5), nice = FALSE, clamp = TRUE) %>%
add_tooltip(function(df){density(df$wt)})
但是当我悬停时,我得到了这个错误:
Error in density.default(df$wt) : argument 'x' must be numeric
谢谢!
【问题讨论】: