R:如何:使用 gplot 和 geom_density 绘制 3d 密度图
我正在尝试将多个密度图与叠加层结合起来.ggplot 和 geom_density 可以完成这项工作,但密度是堆叠在一起的.
I'm trying to combine multiple density plots with overlay. ggplot and geom_density do the job, but the densities are stacked on top of each other.
ggplot(all.complete, aes(x=humid_temp)) +
geom_density(aes(group=height, colour=height, fill=height.f, alpha=0.1)) +
guides(fill = guide_legend(override.aes = list(colour = NULL))) +
labs(main="Temperature by Height", x="Temperature", y="Density")
与此类似的是我正在努力实现的目标:
Something similar to this is what I'm trying to achieve:
就我而言,年份将被高度取代.
In my case, the years would be substituted by height.
谢谢!!!
我知道这个很老,但其他有这种问题的人可能会偶然发现这篇文章,所以我想我会添加一个最近发现的解决方案.刚刚创建了一个新包来完成这种类型的可视化,它被称为 ggjoy
,旨在与 ggplot2 系统一起使用.
I know this old, but other people with this kind of issue may stumble upon this post, so I thought I'd add a recently discovered solution. There is a new package that was just created to do exactly this type of visualization and it is called ggjoy
and is designed to work with the ggplot2 system.
所有信息都可以在这里找到:https://github.com/clauswilke/ggjoy
All of the info can be found here: https://github.com/clauswilke/ggjoy
希望能帮到你!