0
rbokehでカスタマイズされたツールチップを作成しようとしていますが、プログラマチックにそれをやろうとすると、非スタード評価が途中で止まります。例から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は正しくツールチップ内の変数に記入していません。
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