R绘图如何清除选择



我有一个情节图,看起来像这样:

library(plotly)
library(ggplot2)
library(dplyr)
irisd <- iris %>% highlight_key(~Species)
g <- ggplot(irisd, aes(x = Petal.Width, y=Sepal.Width, color = Petal.Length)) + 
geom_point() + 
theme_bw() + theme(plot.title = element_text(size = 20)) + 
scale_color_viridis_c()
ggplotly(g, tooltip = "groups")

这很好,因为它允许我通过点击任何一点来选择整个组。

但是,我希望能够在不重新加载网页的情况下清除所选内容。怎样

只需双击绘图中没有数据点的地方。

最新更新