2016-07-28 54 views
2

我有概率的矩陣:R:在對數標度圖像強度

x <- matrix(runif(16384), ncol = 128) 
image(x) 

現在,我想在對數標度成像的X(即所代表的「概率」圖像強度) 。

任何簡單的建議嗎?

回答

3

image允許使用breaks參數設置着色斷點的靈活性。您可以設置顏色休息根據對數刻度發生:

library(viridis) # you don't need this package, I'm just using it for color palette 

colorBreaks = 10^(seq(-6, 0, by = 1)) # set color breaks however you want 

image(x, breaks = colorBreaks, col = rev(magma(length(colorBreaks) - 1L))) 
# use whatever color palette you want. I used magma() from viridis 

必須有一個更突破之外還有顏色,這就是爲什麼我在col = rev(inferno(length(colorBreaks) - 1L)) enter image description here

-1L