简体   繁体   English

R-稀疏2D数据的热图

[英]R - Heatmap from sparse 2d data

I'd like to achieve what this person has achieved without using ggplot. 我想在不使用ggplot的情况下实现此人的目标。 Any ideas? 有任何想法吗?

How do I create a continuous density heatmap of 2D scatter data in R? 如何在R中创建2D散射数据的连续密度热图?

You can see what I get when using the solution detailed in that question. 您可以看到使用该问题中详细介绍的解决方案时得到的信息。

ggplot(df,aes(x=x,y=y))+
  stat_density2d(aes(alpha=..level..), geom="polygon") +
  scale_alpha_continuous(limits=c(0,1),breaks=seq(0,1,by=0.1))+
  geom_point(colour="red",alpha=0.2)+
  theme_bw()

The heatmap is so sparse. 热图非常稀疏。 I want it to cover much more than what it is covering now. 我希望它涵盖的范围远远超过现在的范围。 It's terribly hard to see anything about the density. 很难看到有关密度的任何信息。 Any ideas of different ways to make density heatmaps from 2D data besides this ggplot solution? 除了此ggplot解决方案以外,还有其他任何想法可从2D数据制作密度热图吗? 在此处输入图片说明

One idea I had was instead of using linear color labeling (see the black to white spectrum on the left, which is linear), using logarithmic scale for the density labeling. 我的一个想法是使用对数刻度进行密度标记,而不是使用线性颜色标记(请参见左侧的黑白光谱,这是线性的)。 Any ideas how I could do this? 有什么想法可以做到吗?

"The heatmap is so sparse. I want it to cover much more than what it is covering now. It's terribly hard to see anything about the density." “热图是如此稀疏。我希望它能覆盖的范围远远超过现在所覆盖的范围。很难看到有关密度的任何信息。”

Please be specific: what do you want to see in areas with most or all NAs? 请具体说明:您想在拥有大多数或所有NA的区域看到什么?

我实际上最终使用了smoothScatter,它运作良好并且使用了经典的R绘图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM