r - 在 R 中找不到 plot_roc_components 中的 plot_generic() 函数
问题描述
我正在使用包中的plot_roc_components
功能rmda
。它的定义有 plot_generic() 函数。但是,我找不到这个函数的定义。为什么会这样?它的原因是看是否有legend.size() 的选项。plot_roc_components
给我图,但是,我想更改图例大小。legend.position 有一个选项,但没有它的字体大小。
你能解释一下吗?谢谢!
解决方案
https://github.com/mdbrown/rmda/blob/57553a4cf5b6972176a0603b412260e367147619/R/plot_functions_sub.R
您正在查看一个文件,但它是在另一个文件中定义的。
plot_generic<- function(xx, predictors, value, plotNew,
standardize, confidence.intervals,
cost.benefit.axis = TRUE, cost.benefits, n.cost.benefits,
cost.benefit.xlab, xlab, ylab,
col, lty, lwd,
xlim, ylim, legend.position,
lty.fpr = 2, lty.tpr = 1,
tpr.fpr.legend = FALSE,
impact.legend = FALSE,
impact.legend.2 = FALSE,
population.size = 1000,
policy = policy, ...){
## xx is output from get_DecisionCurve,
## others are directly from the function call
#save old par parameters and reset them once the function exits.
old.par<- par("mar"); on.exit(par(mar = old.par))
xx.wide <- reshape::cast(xx, thresholds~model, value = value, add.missing = TRUE, fill = NA)
xx.wide$thresholds <- as.numeric(as.character(xx.wide$thresholds))
if(is.numeric(confidence.intervals)){
val_lower <- paste(value, "lower", sep = "_")
val_upper <- paste(value, "upper", sep = "_")
xx.lower <- cast(xx, thresholds~model, value = val_lower, add.missing = TRUE, fill = NA)
xx.upper <- cast(xx, thresholds~model, value = val_upper, add.missing = TRUE, fill = NA)
xx.lower$thresholds <- as.numeric(as.character(xx.lower$thresholds))
xx.upper$thresholds <- as.numeric(as.character(xx.upper$thresholds))
}
# adjust margins to add extra x-axis
if(cost.benefit.axis) par(mar = c(7.5, 4, 3, 2) + 0.1)
#set default ylim if not provided
#initial call to plot and add gridlines
推荐阅读
- sql - sql如何从每个用户的加入计数中获得前5名
- algorithm - 有哪些真正的迭代深度优先搜索实施建议?
- javascript - 数组的许多特定对象属性
- javascript - 在 Javascript 中使用 props.location.query 时如何提取字符串?
- python - sklearn - KNeighborsClassifier - ValueError:未知标签类型:'连续'
- regex - 正则表达式匹配选项卡或没有
- javascript - 如何迭代来自玉模板中的请求的两个或多个 JSON 对象?
- javascript - 如果传递的项目存在于内部的所有数组中,则返回 true - 无法返回 false?
- r - 在地图视图中填充图案?
- java - 向本地主机之外的客户端打开套接字服务器