0
我試圖在rbokeh中進行自定義工具提示,但是當我嘗試以編程方式進行非stadard評估時,rbokeh懸停工具提示 - NSE進入方式
從例如:
library(rbokeh)
mtcars$model <- row.names(mtcars)
figure() %>%
ly_points(disp, mpg, data = mtcars, color = cyl,
hover = "This <strong>@model</strong><br>has @hp horsepower!")
Rbokeh徘徊時,有益填補了@model
和@hp
與變量。但是,當我試圖讓懸停使用的字符串,我可以動態更改,例如:
hover_text <- "This <strong>@model</strong><br>has @hp horsepower!"
mtcars$model <- row.names(mtcars)
figure() %>%
ly_points(disp, mpg, data = mtcars, color = cyl,
hover = hover_text)
rbokeh不正確填寫在提示中的變量。
如何讓rbokeh將hover_text
與原始字符串相同?
我已經嘗試了do.call
的幾個變體,但他們都有錯誤。
ly_points_docall <- function(...) {
do.call(ly_points, list(..., hover = hover_text))
}
figure() %>%
ly_points_docall(disp, mpg, data = mtcars, color = cyl,
hover = hover_text)
# Error in do.call(ly_points, list(..., hover = hover_text)) :
# object 'disp' not found
而且
ly_points_docall <- function(...) {
do.call(ly_points, list(..., hover = hover_text))
}
figure() %>%
ly_points_docall(~disp, ~mpg, data = mtcars, color = ~cyl,
hover = hover_text)
# Error in (function (fig, x, y = NULL, data = figure_data(fig), glyph = 21, :
# formal argument "hover" matched by multiple actual arguments