英文:
geom_dotplot_interactive() removes stacking of points
问题
geom_dotplot_interactive()
允许使用 ggiraph
包创建一个交互式的点图。
library(dplyr)
library(ggplot2)
library(ggiraph)
p <- iris %>%
ggplot(aes(x = Sepal.Length)) +
geom_dotplot_interactive()
girafe(ggobj = p)
然而,一旦我尝试添加工具提示,点就不再堆叠。
p <- iris %>%
mutate(rn = as.character(row_number())) %>%
ggplot(aes(x = Sepal.Length)) +
geom_dotplot_interactive(aes(tooltip = rn))
girafe(ggobj = p)
英文:
geom_dotplot_interactive()
allows to create an interactive dotplot with the package ggiraph
library(dplyr)
library(ggplot2)
library(ggiraph)
p <- iris %>%
ggplot(aes(x = Sepal.Length)) +
geom_dotplot_interactive()
girafe(ggobj = p)
However, as soon as I try to add a tooltip, the points no longer stack.
p <- iris %>%
mutate(rn = as.character(row_number())) %>%
ggplot(aes(x = Sepal.Length)) +
geom_dotplot_interactive(aes(tooltip = rn))
girafe(ggobj = p)
答案1
得分: 1
Tooltip引入了一种新的分组方式(?), 这使得需要更改geom_dotplot_interactive
的一些默认参数以获得相同的结果。具体来说,确定跨组的binpositions和跨组的stack:
p <- iris %>%
mutate(rn = as.character(row_number())) %>%
ggplot(aes(x = Sepal.Length)) +
geom_dotplot_interactive(aes(tooltip = rn), binpositions = "all", stackgroups = TRUE)
girafe(ggobj = p)
英文:
Tooltip introduces a new grouping(?), which makes it necessary to change some of the default arguments of geom_dotplot_interactive
to get the same result. Namely, determine binpositions across groups and stack across groups:
p <- iris %>%
mutate(rn = as.character(row_number())) %>%
ggplot(aes(x = Sepal.Length)) +
geom_dotplot_interactive(aes(tooltip = rn), binpositions = "all", stackgroups = TRUE)
girafe(ggobj = p)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论