R Plotly如何清除选择?

问题描述

我有一个像这样的情节剧情:

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")

这很棒,因为它允许我通过单击任意点来选择整个组。

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

解决方法

只需双击图中没有数据点的某个地方即可。