rbokeh,将图例添加到柱状图中

rbokeh,将图例添加到柱状图中,r,htmlwidgets,rbokeh,R,Htmlwidgets,Rbokeh,我想用rbokeh制作一个图表,其中包括三个重叠的直方图。我可以这样做,但不会显示任何图例: library(rbokeh) figure(tools=c(), legend_location="top_right", padding_factor = 0.01) %>% ly_hist(rnorm(10000, mean=0), color=color_palette[1], alpha = 0.3, breaks=20, lname="L", legend

我想用
rbokeh
制作一个图表,其中包括三个重叠的直方图。我可以这样做,但不会显示任何图例:

library(rbokeh)

figure(tools=c(), legend_location="top_right", padding_factor = 0.01) %>% 
  ly_hist(rnorm(10000, mean=0), 
          color=color_palette[1], alpha = 0.3, breaks=20, lname="L", legend="L", freq=F) %>%
  ly_hist(rnorm(10000, mean=1, sd=0.25), 
          color=color_palette[2], alpha = 0.3, breaks=20, lname="M", legend="M", freq=F) %>%
  ly_hist(rnorm(10000, mean=2, sd=0.5), 
          color=color_palette[3], alpha = 0.3, breaks=20, lname="H", legend="H", freq=F) 
如果我使用的是base R,我需要显式调用
legend()
,如中所示

我没有看到
rbokeh::legend()
函数

有人能建议如何在情节中添加图例吗


提前谢谢

我在
ly\u hist
的文档中没有看到图例。我认为您最好使用
ly_text
并手动添加图例。