【问题标题】:Taylor diagram size, color, save argument?泰勒图大小、颜色、保存参数?
【发布时间】:2020-08-21 08:42:23
【问题描述】:

我生成了泰勒图 使用库:

library(plotrix)
library(rJava)
library(xlsxjars)
library(readxl)
library(xlsx)

和使用的数据dput(df)

structure(list(Pb = c(12.54, 12.53, 13.57, 19.22, 22.27, 18.37, 
19, 14.34, 16.35), Boruta_XGBoost = c(8.89136409759521, 8.85756206512451, 
8.21786308288574, 12.9624891281128, 13.2968854904175, 12.7977981567383, 
12.3957328796387, 9.69775390625, 11.781777381897), Boruta_SVM = c(12.8297886877439, 
14.1176611943491, 14.9879296831078, 18.1703565549757, 19.5840584003096, 
18.8792561701891, 16.2778795502105, 13.4901086669503, 14.2836465797069
), Boruta_RF = c(14.3177444444444, 11.1845266666667, 10.8805244444444, 
17.6771022222222, 20.7142466666667, 18.5657155555556, 16.8954355555556, 
12.9909844444444, 15.9368244444444), GA_XGBoost = c(8.90407180786133, 
8.7996244430542, 8.19470405578613, 12.927845954895, 13.1713933944702, 
12.896990776062, 12.4013185501099, 9.44187641143799, 11.9617586135864
), GA_SVM = c(14.5574045001675, 14.7111528658119, 14.5103784219767, 
17.6100336774524, 19.0957864342351, 17.836320761182, 15.7884998778531, 
13.2352198846198, 14.7596456378561), GA_RF = c(13.7602755555556, 
11.43164, 10.6581822222222, 18.0504933333333, 20.8309088888889, 
18.5738422222222, 16.5107822222222, 12.9161022222222, 15.53854
), XGBoost_XGBoost = c(8.42767715454102, 8.02925300598145, 7.27468395233154, 
12.2474374771118, 13.0366401672363, 13.088475227356, 12.264874458313, 
8.62850284576416, 10.4450559616089), XGBoost_SVM = c(13.0668720920662, 
11.9439605396003, 12.2892781235256, 18.9685052474489, 22.1775370825045, 
18.5729878124879, 18.412140924591, 13.7120185862238, 15.2216196143028
), XGBoost_RF = c(12.5330444444444, 12.6012, 10.6674022222222, 
17.7389044444445, 20.4518844444445, 18.4774088888889, 17.0711288888889, 
12.8564933333333, 14.4656444444444)), row.names = c(NA, -9L), class = c("tbl_df", 
"tbl", "data.frame"))

使用以下代码:

taylor.diagram(Actual,
               Boruta_XGBoost,
               add=FALSE,
               col="#FFFF33", #the color for the points displayed.
               pch=19, #the type of point to display.
               #For Color: ("#FFFFFF" = White, “#990000” = Red) see more:- http://www.cookbook-r.com/Graphs/Colors_(ggplot2)/

               pos.cor=TRUE,
               xlab="Standard deviation (Normalized)", 
               ylab="Standard deviation (Normalized)", 
               main="Taylor Diagram of all applied models Vs Actual",

               show.gamma=TRUE, #whether to display standard deviation arcs around the reference point (only for pos.cor=TRUE).
               ngamma=4, #the number of gammas to display (default=3).
               gamma.col = "red", #color to use for the gamma arcs (only with pos.cor=TRUE).

               sd.arcs=3, #whether to display arcs along the standard deviation axes.
               ref.sd=TRUE, #whether to display the arc representing the reference standard deviation.
               sd.method=TRUE, #Whether to use the sample or estimated population SD.
               grad.corr.lines = c(0.2,0.4,0.6,0.8,0.9), #the values for the radial lines for correlation values

               pcex=2.8, cex.axis=1.8, cex.lab=2.2, #pcex for size of 'pch'; cex.axis for size of tick; 
               normalize=TRUE, #whether to normalize the models so that the reference has a standard deviation of 1.
               mar=c(5,6,5,10), #margin=( bottom, left, top, right); only apply for pos.cor = TRUE plot

               lwd=10,
               font=6,
               lty=1)

我的目标是:

  1. 为什么 x-axis-label 的大小没有增加?但是,我也使用了cex.sub 参数。
  2. 如何增加 gamma 和 sd.arc 线的大小?
  3. 如何改变sd.arc线的颜色?
  4. 如何将此图形保存在可编辑文件中?但是,我使用了library(officer),但没有锻炼
  5. 我们不是有同样的 ggplot2 吗?如果是的话,请分享
  6. 对单个问题的任何单个答案也将不胜感激。 非常感谢!

【问题讨论】:

  • 请确定使用的任何包。
  • 另外,如果不包含在包中,则需要样本数据。我尝试了plotrix 包,但得到了Error in is.data.frame(y) : object 'Boruta_XGBoost' not found
  • 谢谢!我添加了使用的库和数据,请在上面找到
  • 提供的数据包括Boruta_XGBoost,但不包括Actual。那可能是Pb 专栏吗?
  • 我确实使用taylor.diagram(df$Pb, df$Boruta_XGBoost,...复制了您的图表

标签: r ggplot2 save size taylor-series


【解决方案1】:

这是部分答案。问题中按采石场编号的答案:

  1. 您的代码cex.lab=2.2 正在运行。我将其更改为 cex.lab=1 并得到了非常明显的差异。其他 cex 选项同上。

2 - 3. 这些不是函数中的选项。但是,您可以从此处复制该函数的代码:https://github.com/plotrix/plotrix/blob/master/R/taylor.diagram.R 并更改您想要的内容,将其保存为您自己的函数。例如,在注释为“# add the axes”的段中,将颜色选项更改为col = "red" 或其他。

  1. 我不知道您所说的可编辑绘图是什么意思。也许其他人可以解决。

  2. 搜索https://ggplot2.tidyverse.org/reference/index.html 没有找到匹配“taylor”的结果,所以我不这么认为。

【讨论】:

    猜你喜欢
    • 2011-11-04
    • 2014-09-19
    • 1970-01-01
    • 2014-04-03
    • 1970-01-01
    • 2017-08-21
    • 2017-12-02
    • 2014-02-23
    • 1970-01-01
    相关资源
    最近更新 更多