2015-12-02 74 views
0

我正在模擬LST並將其與MODIS數據進行比較。爲了比較不同的模擬,我想使​​用泰勒圖。我能夠使用plotrixR中爲不同的模擬製作基本泰勒圖。但是,有沒有辦法在圖表中包含偏見?我嘗試了以下; Adding bias in Taylor diagram in R。 但是我的身材像apppears包含泰勒圖中的偏差

Figure 1

我是比較新的R,所以這將是巨大的,如果有人可以幫助我在此。

此外,雖然做了一些搜索我碰到較偏的另一種方式來爲

Figure 2

是否有可能在plotrix繪製泰勒圖用這樣的偏見?我發現這個選項更好,因爲我有多個模型需要比較,如果我爲每個偏差繪製矢量和線條,情節會變得混亂。

回答

1

以下代碼說明了一種以偏差爲顏色創建繪圖的方法。必須爲每個模型計算偏差(任意值在代碼中分配)。在此之後,可以創建用於偏差的調色板,然後根據該模型的偏差的顏色區域分配給每個點(模型)的顏色。點(模型)可以使用該模型的特定顏色單獨繪製。偏差的顏色條可以在最後添加。

enter image description here

library(plotrix) # for taylor diagram 
library(RColorBrewer) # for color palette 

# setting random number generator 
set.seed(10) 

# fake some reference data 
ref<-rnorm(30,sd=2) 

model1<-ref+rnorm(30)/2 # add a little noise for model1 
model2<-ref+rnorm(30) # add more noise for model2 
model3<-ref+rnorm(30)*1.1 # add more noise for model3 
model4<-ref+rnorm(30)*1.5 # add more noise for model4 

# making up bias values for each model 
bias1 <- 0.5 
bias2 <- -1 
bias3 <- 0.9 
bias4 <- -0.25 

# making color values 
num_cols <- 8 # number of colors for bias 
cols <- brewer.pal(num_cols,'RdYlGn') # making color palette, many other palettes are available 

# making vector of color breaks 
# breaks define the regions for each color 
min_bias <- -1 # minimum bias 
max_bias <- 1 # maximum bias 
col_breaks <- seq(min_bias,max_bias,(max_bias - min_bias)/(num_cols)) 

# assigning colors based on bias 
# color index assigned based on the value of the bias 
col1 <- cols[max(which(col_breaks <= bias1))] 
col2 <- cols[max(which(col_breaks <= bias2))] 
col3 <- cols[max(which(col_breaks <= bias3))] 
col4 <- cols[max(which(col_breaks <= bias4))] 

# display the diagram and add points for each model 
# use color assigned for each model for that model's point 
taylor.diagram(ref,model1,col=col1) 
taylor.diagram(ref,model2,col=col2,add=T) 
taylor.diagram(ref,model3,col=col3,add=T) 
taylor.diagram(ref,model4,col=col4,add=T) 

# adding color bar 
color.legend(3.5,0,4,2 # coordinates 
      ,(col_breaks[1:(length(col_breaks)-1)]+col_breaks[2:length(col_breaks)])/2 # legend values (mean of color value) 
      ,rect.col=cols # colors 
      ,gradient='y' # vertical gradient 
      ) 
+0

感謝@Calvin Whealton。試了一下測試數據,它效果很好! – rar