在泰勒图中包含偏见

时间:2015-12-02 12:31:52

标签: r plotrix

我正致力于模拟LST并将其与MODIS数据进行比较。为了比较不同的模拟,我想使​​用泰勒图。我可以使用plotrix中的R为不同的模拟制作基本的泰勒图。但是,有没有办法在图表中包含偏差?我尝试了以下几点; Adding bias in Taylor diagram in R。 不过我的数字似乎是

Figure 1

我对R相对较新,所以如果有人可以帮我解决这个问题会很棒。

此外,在进行一些搜索时,我遇到了另一种表示偏见的方式,如

Figure 2

在plotrix中是否可以用这样的偏差绘制泰勒图?我发现这个选项更好,因为我有一个以上的模型需要比较,如果我为每个偏差绘制矢量和线条,情节就会变得杂乱。

1 个答案:

答案 0 :(得分:2)

以下代码说明了使用偏差作为颜色创建绘图的一种方法。必须为每个模型计算偏差(在代码中分配任意值)。在此之后,可以创建偏差的调色板,然后基于该模型的偏差的颜色区域为每个点(模型)分配颜色。可以使用该模型的特定颜色单独绘制点(模型)。偏差的颜色条可以在最后添加。

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
             )