Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带重叠圆(填充和大小)的行-列热图(r)_R_Plot_Ggplot2_Heatmap - Fatal编程技术网

带重叠圆(填充和大小)的行-列热图(r)

带重叠圆(填充和大小)的行-列热图(r),r,plot,ggplot2,heatmap,R,Plot,Ggplot2,Heatmap,下面是我正在尝试绘制的图表: 我有行和列坐标变量,还有三个定量变量(rectheat=填充矩形热图,circlesize=圆的大小,circlefill=填充颜色热图)。NA应以不同的颜色(例如灰色)表示 以下是数据: set.seed (1234) rectheat = sample(c(rnorm (10, 5,1), NA, NA), 7*14, replace = T) dataf <- data.frame (rowv = rep (1:7, 14), columnv = r

下面是我正在尝试绘制的图表:

我有行和列坐标变量,还有三个定量变量(rectheat=填充矩形热图,circlesize=圆的大小,circlefill=填充颜色热图)。NA应以不同的颜色(例如灰色)表示

以下是数据:

set.seed (1234)
rectheat = sample(c(rnorm (10, 5,1), NA, NA), 7*14, replace = T)

dataf <- data.frame (rowv = rep (1:7, 14), columnv = rep(1:14, each = 7),
          rectheat, circlesize = rectheat*1.5,
          circlefill =  rectheat*10 )
dataf

我不确定几何校正是否合适,其他部分是否良好,因为除了错误,我无法得到任何结果

这里最好使用
geom\u tile
(热图)


所有尺寸都与直热炉成比例,只是为了快速取样?您想要一些颜色来填充圆圈吗?是的,这只是为了快速采样,是的,颜色需要由定量变量圆圈填充和与圆圈大小变量成比例的大小填充。感谢agstudy,有没有办法按比例增加圆圈大小与单元格相比,它们看起来很小size@shNIL增加到看起来小?对不起,我不明白。这里的单元格大小是固定的,请你重新措辞好吗?圆圈看起来很小,我希望它们更大(偏离比例)@jon geom_circle?我还不知道这一点。@shNIL如果你改变形状,用shape=21表示几何点会怎么样?几何点(aes(颜色=圆形,大小=圆形,填充=圆形,形状=21)
require(ggplot2)
ggplot(dataf, aes(y = factor(rowv),x = factor(columnv))) +
      geom_rect(aes(colour = rectheat)) +
     geom_point(aes(colour = circlefill, size =circlesize))  + theme_bw()
require(ggplot2)
  ggplot(dataf, aes(y = factor(rowv),
             x = factor(columnv))) +        ## global aes
  geom_tile(aes(fill = rectheat)) +         ## to get the rect filled
  geom_point(aes(colour = circlefill, 
                   size =circlesize))  +    ## geom_point for circle illusion
  scale_color_gradient(low = "yellow",  
                       high = "red")+       ## color of the corresponding aes
  scale_size(range = c(1, 20))+             ## to tune the size of circles
  theme_bw()