R 在热图顶部绘制散点图

R 在热图顶部绘制散点图,r,plot,ggplot2,plotly,R,Plot,Ggplot2,Plotly,我想在热图上绘制一个散点图。我用ggplot绘制了每种类型的图 散点图: lambir_t <- ggplot(l_tree, aes(x=xcoord, [![enter image description here][1]][1]y=ycoord))+geom_point(col='red')+xlim(c(0, 1040))+ylim(c(0, 500)) lambir\u t您可以使用不同的数据集将多个图层添加到绘图中。像通常那样添加点,但指定数据参数。没有数据很难知道,但像这

我想在热图上绘制一个散点图。我用ggplot绘制了每种类型的图

散点图:

lambir_t <- ggplot(l_tree, aes(x=xcoord, 
[![enter image description here][1]][1]y=ycoord))+geom_point(col='red')+xlim(c(0, 1040))+ylim(c(0, 500))

lambir\u t您可以使用不同的数据集将多个图层添加到绘图中。像通常那样添加点,但指定数据参数。没有数据很难知道,但像这样的事情可能会帮到你:

ggplot(dfo, aes(x,y,fillz)) + 
  geom_tile(color='white') + 
  scale_fill_gradient(low='white', high='blue') + 
  labs(x='x', y='y', title='Lambir Hills', fill='Phosphorus') +
  geom_point(data=l_tree, aes(x=xcoord, [![enter image description here][1]][1], y=ycoord)), col='red')

我发现使用相同的数据集,但在每一层中显式显示数据集可以很容易地在瓷砖顶部绘制点

颜色按预期工作。 奇怪的是,当为所有尺寸设置不同的值时,尺寸效果更好

ggplot(data = mydata, aes(x = baseofheatmap, y = heightofheatmap)) + 
  geom_tile(data = mydata, 
            aes(fill = valuetoheatmap)) +
  geom_point(data = mydata, 
             aes(x = valuetopoint, 
                 y = heightofheatmap, 
                 size = valuetopoint, 
                 color = "red"))

您正在
aes()
语句中设置大小,这是错误的。无论如何,这仍然不是一个可重复的例子。请阅读:
ggplot(data = mydata, aes(x = baseofheatmap, y = heightofheatmap)) + 
  geom_tile(data = mydata, 
            aes(fill = valuetoheatmap)) +
  geom_point(data = mydata, 
             aes(x = valuetopoint, 
                 y = heightofheatmap, 
                 size = valuetopoint, 
                 color = "red"))