小编use*_*019的帖子

用ggplot2绘制热图; logscale颜色和修改颜色图例

我正在尝试创建一个热图ggplot2(你看到下面的代码)现在有两件事我想改变:

  1. 我绘制pValues(希望非常小),所以我想绘制颜色logscale.我尝试了trans ="log"的不同变体,但都没有奏效
  2. 我想在图例中显示超过6个值.我尝试了例如休息,标签,但这不起作用

    (p <- ggplot(dataPVal.m, aes(variable, structure)) + 
          geom_tile(aes(fill = pValue), colour = "white") + 
          scale_colour_gradientn(colour = rainbow(100), breaks = c(1,2,3,4,5,6), labels =c("a","b","c","d","e","f")) +
          theme_grey(base_size = base_size) + 
          labs(x = "position (0=seed start)",y = "structure") + ## labels
          #scale_x_discrete(expand = c(0.01, 0.01)) +            ## grauer rand oben/unten
          #scale_y_discrete(expand = c(0.01, 0.01)) +            ## grauer rand links/rechts
          opts(title=plot_title,legend.position = "left",axis.ticks = theme_blank(), axis.text.x = theme_text(size = base_size * 0.8, angle = 330, hjust = 0, colour = …
    Run Code Online (Sandbox Code Playgroud)

r legend heatmap ggplot2

2
推荐指数
1
解决办法
5564
查看次数

标签 统计

ggplot2 ×1

heatmap ×1

legend ×1

r ×1