admin管理员组文章数量:1278653
ggiraph
is great! But I'm wondering if there's a way to set default css properties for data_id items outside of opts_hover()
/opts_hover_inv()
. Here's a minimal reprex:
library(ggplot2)
library(ggiraph)
ggobj <-
mtcars |>
ggplot(aes(x = qsec,
y = hp,
color = as.character(gear),
data_id = gear)) +
geom_point_interactive(alpha = 0.5)
girafe(
ggobj = ggobj,
options = list(
opts_hover("opacity:1;"),
opts_hover_inv("opacity:0;")
)
)
Here, each point is at 50% opacity when I'm not hovering on anything:
When I hover on one gear type, the others disappear as expected due to the css in opts_hover_inv()
. However, the the hovered gear stays at 50% opacity. I think that this is because it's treating opacity and alpha as two separate entities. So when I'm hovering, the hovered group has 1 * 0.5
opacity.
Is there a way to get the desired output of:
- default to 50% opacity when not hovering
- hovered elements tied to the
data_id
go to 100% opacity - inverse of hovered elements go to 0% opacity
本文标签: rset default opacity using ggiraphgirafeStack Overflow
版权声明:本文标题:r - set default opacity using ggiraph::girafe? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741235061a2362846.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论