【发布时间】:2020-10-29 19:39:48
【问题描述】:
有没有办法用新的第三个六边形图来可视化两个geom_hex 图之间的差异?
ggplot(diamonds, aes(carat, price)) +
geom_hex(aes(fill = stat(ncount)))
set.seed(123)
diamonds2 <- diamonds %>%
mutate(price = jitter(price, amount = 500), carat = jitter(carat, amount = 2))
ggplot(diamonds2, aes(carat, price)) +
geom_hex(aes(fill = stat(ncount)))
我曾考虑使用 ggplot_build 提取数据,对其进行操作并重新组装绘图,但这会导致问题,即 bin 不一样,我需要以某种方式调整颜色规模。
非常感谢您对如何实现这一目标的任何想法。
【问题讨论】: