如何创建交互式瀑布图?R

如何创建交互式瀑布图?R,r,ggplot2,shiny,R,Ggplot2,Shiny,我得到了一个瀑布图,我想让它反应。 为了显示瀑布图,我使用了以下行: ggplot(a, aes(WorkArea, fill = type)) + geom_rect(aes(x = WorkArea, xmin = id -0.45, xmax = id + 0.45, ymin = end, ymax =start))+scale_y_continuous(breaks=seq(0,round(max(as.numeric(a$TEST))),1)) 我的数据如下: >dput(a

我得到了一个瀑布图,我想让它反应。 为了显示瀑布图,我使用了以下行:

ggplot(a, aes(WorkArea, fill = type)) + geom_rect(aes(x = WorkArea, xmin = id -0.45, xmax = id + 0.45, ymin = end, ymax =start))+scale_y_continuous(breaks=seq(0,round(max(as.numeric(a$TEST))),1))
我的数据如下:

>dput(a)
structure(list(WorkArea = structure(1:12, .Label = c("W04-2017","1","2","3","4", "5", "6", "7", "8", "9", "10", "W02-2017"), class ="factor"), type = c("Reference", "GAP -", "GAP +", "GAP +", "GAP +", "GAP -","GAP +", "GAP +", "GAP -", "GAP +", "GAP -", "Reference"), id = 1:12, end =c(7.76, 7.74633088087763, 7.9153571928874, 8.00995033541827, 8.12310088678836, 7.95370807262163, 8.29697519437368, 8.31463895449699, 8.28302107983506,8.29280710260114, 8.28, 0), start = c(0, 7.76, 7.74633088087763, 7.9153571928874, 8.00995033541827, 8.12310088678836, 7.95370807262163,8.29697519437368,8.31463895449699, 8.28302107983506, 8.29280710260114, 8.28),TEST = list(7.76, -0.0136691191223706, 0.169026312009775, 0.0945931425308611, 0.113150551370094, -0.169392814166733, 0.343267121752054, 0.017663760123311, -0.0316178746619267,0.00978602276607453, -0.01280710260114, 9.45)), .Names = c("WorkArea","type", "id", "end", "start", "TEST"), class = "data.frame", row.names = c(NA, 12L))
我的想法是:当用户单击一个栏时,它会高亮显示,并显示一个表,其中包含有关该组(该栏)的详细信息。要做到这一点,我必须获得有关该小组的信息

我怎么能这么做


为便于将
ggplot2
项目转换为交互式/反应性图形,我建议查看
plotly
ggplotly
glish
的使用,这有助于将
ggplot2
项目转换为交互式/反应性图形,我建议查看
plotly
,并在
glishing
中使用
ggplotly
,这可能会对您有所帮助