此代码生成我想要的图表,但我希望将input_radiobuttons
的内容作为垂直轴标签代替随机字符串reactive_931110099
。
library(ggvis)
mtcars %>% ggvis(x = ~wt, y= input_radiobuttons(
choices = c("mpg" = 'mpg', "disp" = 'disp'),
label = "Y-axis",
map = as.name)
)
layer_densities(
adjust = input_slider(.1, 2, value = 1, step = .1, label = "Bandwidth adjustment"),
kernel = input_select(
c("Gaussian" = "gaussian",
"Epanechnikov" = "epanechnikov",
"Rectangular" = "rectangular",
"Triangular" = "triangular",
"Biweight" = "biweight",
"Cosine" = "cosine",
"Optcosine" = "optcosine"),
label = "Kernel")
)
答案 0 :(得分:1)
mtcars %>% ggvis(x = ~wt, y= input_radiobuttons(
choices = c("mpg" = 'mpg', "disp" = 'disp'),
label = "Y-axis",
map = as.name)
) %>%
add_axis("y", title = "Pick Your Own Label", title_offset = 50)
layer_densities(
adjust = input_slider(.1, 2, value = 1, step = .1, label = "Bandwidth adjustment"),
kernel = input_select(
c("Gaussian" = "gaussian",
"Epanechnikov" = "epanechnikov",
"Rectangular" = "rectangular",
"Triangular" = "triangular",
"Biweight" = "biweight",
"Cosine" = "cosine",
"Optcosine" = "optcosine"),
label = "Kernel")
)